D
D
Dim Boy2015-11-23 15:51:00
PHP
Dim Boy, 2015-11-23 15:51:00

How to make the mail sending code work?

How to change the code correctly?
When you arrive at the post office - the sender is empty

//echo $t;
          $str='';
          $from = "[email protected]";
          $subject = $main_smarty->get_config_vars('Email_Subject');
          $to = $t;
          $message = sprintf($main_smarty->get_config_vars('PLIGG_InvitationEmail_Message'));
          
          //echo $to.":".$site_mail.":".$subject."$message<br/>";
          
          $mail = new PHPMailer();
          $mail->From = $site_mail;
          $mail->FromName = $main_smarty->get_config_vars('Email_SiteName');
          $mail->AddAddress($to);
          $mail->AddReplyTo($site_mail);
          $mail->IsHTML(true);
          $mail->Subject = $subject;
          $mail->Body = $message;
          $mail->CharSet = 'utf-8';
          $mail->Send();

with this code:
comes from [email protected]
//echo $t;
          $str='';
          $site_mail = "[email protected]";
          $subject = $main_smarty->get_config_vars('Email_Subject');
          $to = $t;
          $message = sprintf($main_smarty->get_config_vars('PLIGG_InvitationEmail_Message'));
          
          //echo $to.":".$site_mail.":".$subject."$message<br/>";
          
          $mail = new PHPMailer();
          $mail->FromName = $main_smarty->get_config_vars('Email_SiteName');
          $mail->AddAddress($to);
          $mail->AddReplyTo($site_mail);
          $mail->IsHTML(true);
          $mail->Subject = $subject;
          $mail->Body = $message;
          $mail->CharSet = 'utf-8';
          $mail->Send();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2015-11-23
@alexey-m-ukolov

When you arrive at the post office - the sender is empty
Because the $site_mail variable is not defined in this code.
comes from [email protected]
Well, here the sender is not indicated at all, so the default address is used .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question