I
I
igorc752020-11-09 17:24:20
PHP
igorc75, 2020-11-09 17:24:20

When sending mail via SMTP, there is only 1 character in the sender's name, how to fix it?

I use SendMailSmtpClass, which is taken from github
. Messages come to the mail, but there is only 1 character in the sender's name. Do not tell me how to fix it?

5fa9513eafa36447050356.jpeg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2020-11-09
@galaxy

Because

$headers .= "From: {$smtp_from[0]} <{$smtp_from[1]}>\r\n"; // от кого письмо

In his send () method, the parameter from whom should be an array, as in the example on the github:
// от кого
  $from = array(
    "Евгений", // Имя отправителя
    "[email protected]" // почта отправителя
  );
...
$result =  $mailSMTP->send($to, 'Тема письма с копиями ', 'Текст письма', $from);

In general, do not use these crafts from someone's knees when there is, for example, PHP Mailer. It is not known how many more rakes there are. For example, this has really bothered me:
fputs($socket, "MAIL FROM: <".$this->smtp_username.">\r\n");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question