Hi. guys, the order messages come from the email address of the hosting noreply@unverified.beget.ru . No hosting provider, no I can’t find the reason. Maybe there are options ? Thanks
I don’t understand your question!
Also, what extra are you talking about? Minishop2?
I did a quick search in the source code, and the value for the sender email address seems to come from the system setting emailsender
.
Hi. Hosting says you need to have such a header $headers = “From: $from\nReply-To: $from\n”; . Below is the code of their test form.
<?php
if($_GET['email'])
{
$to = $_GET['email'];
$from = 'begettest@'.$_SERVER['HTTP_HOST'];
$subject = 'Mail test';
$message = 'PHP mail() on '.$_SERVER['HTTP_HOST'].' works';
$boundary = '---';
$headers = "From: $from\nReply-To: $from\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"\n";
$headers .= "MIME-Version: 1.0";
$body = "--$boundary\n";
$body .= "Content-type: text/plain; charset='utf-8'\n";
$body .= "Content-Transfer-Encoding: quoted-printablenn";
$body .= "Content-Disposition: attachment; filename==?utf-8?B?".base64_encode($filename)."?=\n\n";
$body .= $message."\n";
$body .= "--$boundary\n";
$filename = basename(__FILE__);
$file = fopen($filename, "r"); //Открываем файл
$text = fread($file, filesize($filename)); //Считываем весь файл
fclose($file); //Закрываем файл
$body .= "Content-Type: application/octet-stream; name==?utf-8?B?".base64_encode($filename)."?=\n";
$body .= "Content-Transfer-Encoding: base64\n";
$body .= "Content-Disposition: attachment; filename==?utf-8?B?".base64_encode($filename)."?=\n\n";
$body .= chunk_split(base64_encode($text))."\n";
$body .= "--".$boundary ."--\n";
if (mail($to, $subject, $body, $headers,"-f{$from}")): echo 'sent';
else: echo 'not sent';
endif;
}
else
{
?>
<meta charset="utf-8">
<form action="<?= basename(__FILE__) ?>">
<input name="email" type="email" placeholder="почта"></input>
<button type="submit">Отправить письмо</button>
</form>
<?php
}
?>
In MODX, E-Mails are usually sent using the class “modPHPMailer” (that then internally uses the “PHPMailer” library).
The “From:” header should be generated automatically using the value that is set for modMail::MAIL_FROM
:
hi. I don’t understand what needs to be done. could you show me ?
The code I linked above shows how emails are sent in Minishop2.
In the highlighted line, the “From” address is set. It’s set to the value of the emailsender
system setting ($this->modx->getOption('emailsender')
).
Maybe also read the documentation page about “modMail”:
https://docs.modx.com/current/en/extending-modx/services/modmail
Hello. Then it turns out that this is not the problem, if “From". specified on (‘emailsender’))