问题描述
我开始使用 Jmail 方法通过扩展程序发送电子邮件:http://docs.joomla.org/Sending_email_from_extensions
I am starting to use the Jmail method to send emails via an extension: http://docs.joomla.org/Sending_email_from_extensions
但该方法似乎不允许为收件人指定姓名,至少我还没有找到方法.
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);
文档 说:混合 $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(或从平台版本 11.1 开始)该函数接受两个参数:
In Joomla! 2.5 (or starting with the Platform version 11.1) the function accepts two parameters:
公共函数 addRecipient($recipient, $name = '')
哪里
$recipient - 字符串或字符串数组 [电子邮件地址]
$recipient - Either a string or array of strings [email address(es)]
$name - 字符串或字符串数组 [name(s)]
$name - Either a string or array of strings [name(s)]
用法:
$mailer = JFactory::getMailer();
$mailer->addRecipient('[email protected]', 'John Doe');
这篇关于Joomla Jmail addRecipient with name的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!