Enhance email settings functionality by adding sender address support (#668)

Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Chirag Chhatrala
2025-01-27 20:37:01 +05:30
committed by GitHub
parent a91c194161
commit 4fae4e6328
3 changed files with 31 additions and 6 deletions

View File

@@ -22,29 +22,33 @@ class EmailSettingsRequest extends FormRequest
*/
public function rules()
{
$allFieldsPresent = $this->filled(['host', 'port', 'username', 'password']);
$allFieldsPresent = $this->filled(['host', 'port', 'username', 'password', 'sender_address']);
return [
'host' => [
$allFieldsPresent ? 'required' : 'nullable',
'required_with:port,username,password',
'required_with:port,username,password,sender_address',
'string',
],
'port' => [
$allFieldsPresent ? 'required' : 'nullable',
'required_with:host,username,password',
'required_with:host,username,password,sender_address',
'integer',
],
'username' => [
$allFieldsPresent ? 'required' : 'nullable',
'required_with:host,port,password',
'required_with:host,port,password,sender_address',
'string',
],
'password' => [
$allFieldsPresent ? 'required' : 'nullable',
'required_with:host,port,username',
'required_with:host,port,username,sender_address',
'string',
],
'sender_address' => [
'nullable',
'email',
],
];
}