简体   繁体   English

如何从表格发送mailgun电子邮件?

[英]How to send mailgun email from form?

I would like to use a form to send a verification email though mailgun to users when they sign up for a service. 我想使用一种表单在用户注册服务时通过mailgun向其发送验证电子邮件。 I have a form collecting the required info for the email but need to put it into the email. 我有一个表格,用于收集电子邮件的必需信息,但需要将其放入电子邮件中。 The problem is the way the email is formatted and I do not know how to print the data. 问题是电子邮件的格式化方式,我不知道如何打印数据。

Here is my action: 这是我的动作:

<?php
require 'vendor/autoload.php';
use Mailgun\Mailgun;

$mgClient = new Mailgun('MY-API-KEY');
$domain =     "https://api.mailgun.net/v3/MY-DOMAIN";

$result = $mgClient->sendMessage($domain, array(
'from'    => 'Verifier <MY-ADDRESS>',
'to'      => '<?php print_r(GET_$[email]) ?>, second-address@email.com',
'subject' => 'Verifcation & Instructions',
'text'    => 'Dear print_r(GET_$[username]),

Thank you for requesting a service for print_r(GET_$[url]).

To make sure this was you, please <a href="link">click here</a> and verify ...'
));
?>

I know the send is working because of the second address I have set up. 我知道由于我设置的第二个地址,发送正在工作。

Thanks for any help! 谢谢你的帮助!

这是Mailgun支持人员提供给我的可能解决方案: http ://blog.mailgun.com/double-opt-in-with-php-mailgun/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM