:
Why is there such a situation?
Reply to discussion (solution)
These are the custom prompts, specifically why, to look at the code. Follow the code below ...
Require_once Application_path. ' /models/class.phpmailer.php ';
Send mail
Class send_mail{
function Send_mail ($fromname, $subject, $content, $user _mail)
{
$mail = new Phpmailer (); Instantiation of
$mail->issmtp (); Enable SMTP
$mail->host = "smtp.163.com"; SMTP Server Sina Mailbox
$mail->port = 25; Mail Send port
$mail->smtpauth = true; Enable SMTP authentication
$mail->charset = "UTF-8"; Character
$mail->encoding = "base64"; Encoding method
$mail->username = "yzhjtx@163.com"; Your e-mail
$mail->password = "hjtx123456"; Your password.
$mail->subject = $subject; Message header
$mail->from = "yzhjtx@163.com"; Sender address (that is, your mailbox)
$mail->fromname = $fromname; Sender's name
$address = "$user _mail";//Recipient Email
$mail->addaddress ("$address");//Add recipient address, nickname
$mail->ishtml (TRUE); Support HTML format content
$emailtype = "HTML"; Letter type, text: text; Web page: HTML
$mail->body = $content;//message content
if (! $mail->send ()) {
return false;
} else {
return true; Sent successfully
}
}
}
These are the custom prompts, specifically why, to look at the code. Follow the code below ...
The code to send the message:
Require_once Application_path. ' /models/class.phpmailer.php ';
Send mail
Class send_mail{
function Send_mail ($fromname, $subject, $content, $user _mail)
{
$mail = new Phpmailer (); Instantiation of
$mail->issmtp (); Enable SMTP
$mail->host = "smtp.163.com"; SMTP Server Sina Mailbox
$mail->port = 25; Mail Send port
$mail->smtpauth = true; Enable SMTP authentication
$mail->charset = "UTF-8"; Character
$mail->encoding = "base64"; Encoding method
$mail->username = "yzhjtx@163.com"; Your e-mail
$mail->password = "hjtx123456"; Your password.
$mail->subject = $subject; Message header
$mail->from = "yzhjtx@163.com"; Sender address (that is, your mailbox)
$mail->fromname = $fromname; Sender's name
$address = "$user _mail";//Recipient Email
$mail->addaddress ("$address");//Add recipient address, nickname
$mail->ishtml (TRUE); Support HTML format content
$emailtype = "HTML"; Letter type, text: text; Web page: HTML
$mail->body = $content;//message content
if (! $mail->send ()) {
return false;
} else {
return true; Sent successfully
}
}
}
Invalid address is not valid
Invalid address is not valid
But the Mail has been sent out, my mailbox received a new mail
You see class.phpmailer.php there is no Invalid address hint, if not, the whole project search.
Take a closer look and see where this information is, and know why. Basic Debugging Method!
Look at the tip is email is not correct.
If you can receive the message, but the mail server returns the prompt, you need to check what state the class.phpmailer.php is receiving.
Public Function addaddress ($address, $name = ") {
return $this->addanaddress (' to ', $address, $name);
}
Private Function Addanaddress ($kind, $address, $name = ") {
if (!preg_match ('/^ (to|cc|bcc| ReplyTo) ($/', $kind)) {
Echo ' Invalid recipient array: '. Kind
return false;
}
$address = Trim ($address);
$name = Trim (preg_replace ('/[\r\n]+/', ' ', $name)); Strip breaks and trim
if (!self::validateaddress ($address)) {
$this->seterror ($this->lang (' invalid_address '). ': ' $address);
if ($this->exceptions) {
throw new Phpmailerexception ($this->lang (' invalid_address '). ': ' $address);
}
echo $this->lang (' invalid_address '). ': ' $address;
return false;
}
...