55 ->configurePrimary(
true)
56 ->configureAutocomplete(
true)
57 ->configureTitle(Loc::getMessage(
"main_mail_sender_id_title")),
60 ->configureRequired(
true)
61 ->configureTitle(Loc::getMessage(
"main_mail_sender_email_title")),
64 ->configureTitle(Loc::getMessage(
"main_mail_sender_name_title")),
67 ->configureAutocomplete(
true)
68 ->configureTitle(Loc::getMessage(
"main_mail_sender_user_id_title")),
71 ->configureStorageValues(
"0",
"1")
72 ->configureDefaultValue(
"0")
73 ->configureTitle(Loc::getMessage(
"main_mail_sender_is_confirmed_title")),
76 ->configureStorageValues(
"0",
"1")
77 ->configureDefaultValue(
"0")
78 ->configureTitle(Loc::getMessage(
"main_mail_sender_is_public_title")),
81 ->configureSerializationPhp()
82 ->configureRequired(
false)
83 ->configureTitle(Loc::getMessage(
"main_mail_sender_options_title"))
84 ->addSaveDataModifier(
function($value)
86 $value = unserialize($value, [
'allowed_classes' =>
false]);
87 if (!empty($value[
'smtp'][
'password']))
89 $value[
'smtp'][
'encrypted'] =
false;
92 if (!empty($cryptoOptions[
'crypto_key']))
98 $value[
'smtp'][
'password'] = $cipher->encrypt(
99 $value[
'smtp'][
'password'],
100 $cryptoOptions[
'crypto_key']
102 $value[
'smtp'][
'encrypted'] =
true;
109 $value[
'smtp'][
'password'] = base64_encode($value[
'smtp'][
'password']);
112 return serialize($value);
114 ->addFetchDataModifier(
function($value)
116 if (!empty($value[
'smtp'][
'password']))
118 $value[
'smtp'][
'password'] = base64_decode($value[
'smtp'][
'password']);
120 if (!empty($value[
'smtp'][
'encrypted']))
123 if (!empty($cryptoOptions[
'crypto_key']))
129 $value[
'smtp'][
'password'] = $cipher->decrypt(
130 $value[
'smtp'][
'password'],
131 $cryptoOptions[
'crypto_key']
133 unset($value[
'smtp'][
'encrypted']);
141 if (!empty($value[
'smtp']) && is_array($value[
'smtp']))
143 if (empty($value[
'smtp'][
'protocol']))
145 if (465 == $value[
'smtp'][
'port'])
147 $value[
'smtp'][
'protocol'] =
'smtps';
148 }
else if (587 == $value[
'smtp'][
'port'])
150 $value[
'smtp'][
'protocol'] =
'smtp';
158 ->configureDefaultValue(
'main')
161 ->configureNullable(),