Php邮件程序 - 无法发送邮件。邮件程序错误:无效地址:(cc): [英] Php mailer - message could not be sent. Mailer error: invalid address: (cc):
本文介绍了Php邮件程序 - 无法发送邮件。邮件程序错误:无效地址:(cc):的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用PHPMailer类并对某些邮件地址使用$ Variables。
问题是如果$ Variable为空,PHP Mailer会回复: -
I am using PHPMailer class and using $Variables for some of the mail addresses.
The problem is that if the $Variable is empty, PHP Mailer responds with :-
Message could not be sent. Mailer Error: Invalid address: (cc):
代码的一部分如下:: -
A portion of the code is as follows::-
$mail = new PHPMailer(true); // Passing `true` enables exceptions
try {
//Server settings
//$mail->SMTPDebug = 2; // Enable verbose debug output
$mail - > isSMTP(); // Set mailer to use SMTP
$mail - > Host = 'mail.smtp2go.com'; // Specify main and backup SMTP servers
$mail - > SMTPAuth = true; // Enable SMTP authentication
$mail - > Username = 'xxx'; // SMTP username
$mail - > Password = 'xxx'; // SMTP password
$mail - > SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail - > Port = 2525; // TCP port to connect to
//Recipients
$mail - > AllowEmpty = true;
$mail - > setFrom('adrian@ic-express.co.za', 'Adrian Boshoff');
//$mail->addAddress($mrow['email']); //This is an example of creating a variable from an array field
$mail - > addAddress($email); //This is an example of creating a variable from an array field
$mail - > addReplyTo('adrian@ic-express.co.za');
$mail - > addCC($addemail);
$mail - > AllowEmpty = true;
//$mail->addBCC('adrian@ic-express.co.za');
//Attachments
$mail - > addAttachment('eco.pdf'); // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail - > isHTML(true); // Set email format to HTML
$mail - > Subject = $subject;
$mail - > Body = << < END < !doctype html >
< html xmlns = "http://www.w3.org/1999/xhtml"
xmlns: v = "urn:schemas-microsoft-com:vml"
xmlns: o = "urn:schemas-microsoft-com:office:office" >
< head >
<!-- NAME: SELL PRODUCTS -->
我尝试过的方法:
我尝试添加
What I have tried:
I tried adding
$mail->AllowEmpty = true;
哪个没有帮助。
Which has not helped.
推荐答案
某些邮件地址的变量。
问题是如果
Variables for some of the mail addresses.
The problem is that if the
变量为空,PHP Mailer会响应: -
Variable is empty, PHP Mailer responds with :-
Message could not be sent. Mailer Error: Invalid address: (cc):
代码的一部分如下:: -
A portion of the code is as follows::-
mail = new PHPMailer(true); //传递`true`启用例外
try {
//服务器设置
//
mail = new PHPMailer(true); // Passing `true` enables exceptions try { //Server settings //
这篇关于Php邮件程序 - 无法发送邮件。邮件程序错误:无效地址:(cc):的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文