问题描述
我开始使用Jmail方法通过扩展名发送电子邮件:
I am starting to use the Jmail method to send emails via an extension: http://docs.joomla.org/Sending_email_from_extensions
但是,该方法似乎不允许为收件人指定名称,至少我没有找到办法。 / p>
But the method doesn't seem to allow specifying names for the recipient, at least I haven't found the way to do it.
$mailer->addRecipient($recipient);
说: mixed $ recipient:字符串或字符串数组[e-mail address(es)]
任何人都知道如何将名称添加到收件人?
Anyone knows how to add the name to the recipient?
我使用的是Joomla 2.5, 1.5方法工作。
I'm using Joomla 2.5, the 1.5 method works.
推荐答案
在Joomla! 2.5(或从Platform版本11.1开始),函数接受两个参数:
In Joomla! 2.5 (or starting with the Platform version 11.1) the function accepts two parameters:
public function addRecipient($ recipient,$ name ='')
其中
$ recipient - 字符串或字符串数组[email address(es)]
$recipient - Either a string or array of strings [email address(es)]
$ name - 字符串或字符串数组[name]
$name - Either a string or array of strings [name(s)]
用法:
$ mailer = JFactory :: getMailer() code>
$mailer = JFactory::getMailer();
$ mailer-> addRecipient('john.doe@example.com','John Doe'); / code>
$mailer->addRecipient('john.doe@example.com', 'John Doe');
这篇关于Joomla Jmail addRecipient与名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!