PHPMailer AddAddress() [英] PHPMailer AddAddress()

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

问题描述

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

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.

推荐答案

您需要为每个要发送到的 E-Mail 地址调用一次 AddAddress 函数.此函数只有两个参数:recipient_email_addressrecipient_name.收件人姓名是可选的,如果不存在则不会使用.

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');

您可以使用数组来存储收件人,然后使用 for 循环.我希望它有所帮助.

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

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

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