gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 23:02:53 24 4
gpt4 key购买 nike

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

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

我相信对于注册,系统使用 authorize.net
我怎样才能做到这一点?

谢谢您的帮助!!

最佳答案

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

$subject = "Here is the subject of your message.";
$body = "Here is the body of your message.";
$user = JFactory::getUser();
$to = $user->email;
$from = array("me@mydomain.com", "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($body);

# 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("blindcopy@yourdomain.com");

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

关于email - 我如何通过 joomla 发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18820118/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com