Job*_*ose 0 php joomla sendmail
我在Joomla JUtility :: sendMail函数中遇到了一个问题
Joomla文档中提到的函数参数是这样的
问题是我无法设置fromemail(发件人电子邮件).当我设置发件人电子邮件并重播电子邮件时.邮件中显示的电子邮件重播是来自joomla admin config email的邮件.当我将其他电子邮件设置为重播或发件人电子邮件时,每次使用来自joomla admin config的电子邮件时,它都没有正确使用.
我得到了谷歌的一个参考几乎相同,但我试过这不起作用.
我正在使用Joomla 1.7
我试过了
$your_email //can be array but here string one email
$your_name //name i will work fine
$user_email //admin email
$subject //subject
//last two argument is reply to and replay name Its showing inside mail but click on replay it will admin config email.
JUtility::sendMail($your_email, $your_name, $user_email, $subject, $fcontent,1,NULL,NULL,NULL,$your_email,$your_name);
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激..
试试这样吧
$mailer =& JFactory::getMailer();
Run Code Online (Sandbox Code Playgroud)
//添加发件人信息.
$sender = array(
$your_email,
$your_name
);
$mailer->setSender($sender);
Run Code Online (Sandbox Code Playgroud)
//添加收件人 $ recipient = $ user_email;
$mailer->addRecipient($recipient);
Run Code Online (Sandbox Code Playgroud)
//添加主题
$mailer->setSubject('Your subject string');
Run Code Online (Sandbox Code Playgroud)
//添加身体
$mailer->setBody($fcontent);
$send =& $mailer->Send();
if ( $send !== true ) {
echo 'Error sending email: ' . $send->message;
} else {
echo 'Mail sent';
}
Run Code Online (Sandbox Code Playgroud)
已完成.有关详细信息,请参阅此链接从扩展程序发送电子邮件.
我认为它可能对你有帮助.