PHPMailer的AddAddress() [英] PHPMailer AddAddress()

查看:396
本文介绍了PHPMailer的AddAddress()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何将数据格式化为AddAddress PHPMailer函数;我需要电子邮件发送给多个收件人,所以我试过

  $ to =me @ domain.com,you @ domain .NET,她@ domain.it; 
$ obj-> AddAddress($ to);

但没有成功。任何帮助将不胜感激。 您想要发送到的邮件地址。这个函数只有两个参数: recipient_email_address recipient_name 。收件人名称是可选的,如果不存在,将不会使用。

  $ mailer-> AddAddress(在1:1) 
$邮件程序 - > AddAddress(的领导者2 @ domain.com','第二名称');
$邮件程序 - > AddAddress(第三方名称);

您可以使用数组来存储收件人,然后使用 / code>循环。我希望它有帮助。

I don't know how the data should be formatted for AddAddress PHPMailer function; I need the email to be sent to multiple recipients so I tried

$to = "me@domain.com,you@domain.net,she@domain.it";
$obj->AddAddress($to);

but with no success. Any help will be appreciated.

解决方案

You need to call the AddAddress function once for each E-Mail address you want to send to. There are only two arguments for this function: recipient_email_address and recipient_name. The recipient name is optional and will not be used if not present.

$mailer->AddAddress('recipient1@domain.com', 'First Name');
$mailer->AddAddress('recipient2@domain.com', 'Second Name');
$mailer->AddAddress('recipient3@domain.com', 'Third Name');

You could use an array to store the recipients and then use a for loop. I hope it helps.

这篇关于PHPMailer的AddAddress()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆