我如何通过joomla发送电子邮件

问题描述 投票:4回答:1

我有一个系统,所以人们可以通过我的Joomla网站注册课程(我相信它是3.0)。但是从那里开始,我想向人们发送一封填写注册变量的电子邮件。所以类似于:

Dear (name), thank you for registering for (class). 
This is to remind you your class is tomorrow, (date), at (place).

我相信注册,系统使用authorize.net

我怎么能做到这一点?

谢谢您的帮助!!

email joomla authorize.net
1个回答
9
投票

您可以使用JFactory:getMailer中建议的following post。我在这里复制他的代码示例(修改了一下):

$body = "Here is the body of your message.";
$user = JFactory::getUser();
$to = $user->email;
$from = array("[email protected]", "Brian Edgerton");

# Invoke JMail Class
$mailer = JFactory::getMailer();

# Set sender array so that my name will show up neatly in your inbox
$mailer->setSender($from);

# Add a recipient -- this can be a single address (string) or an array of addresses
$mailer->addRecipient($to);

$mailer->setSubject($subject);
$mailer->setBody($subject);

# If you would like to send as HTML, include this line; otherwise, leave it out
$mailer->isHTML();

# Send once you have set all of your options
$mailer->send();

这就是发送简单电子邮件的全部内容。如果您想添加抄送收件人,请在发送电子邮件之前包括以下内容:

# Add a blind carbon copy
$mailer->addBCC("[email protected]");

另一种选择是使用JMail::sendMailhttp://docs.joomla.org/API17:JMail::sendMail

© www.soinside.com 2019 - 2024. All rights reserved.