[英]How to use SMTP to send email in ionic 3?
我正在尝试使用Gmail SMTP发送电子邮件。 我检查了很多解决方案,但无济于事。
今天,我发现此站点https://www.smtpjs.com/可能会帮助我解决问题,但我需要帮助才能知道应将该HTML行放在哪里:
<script src="https://smtpjs.com/v2/smtp.js"></script>
然后,如何在home.ts中导入电子邮件以使用此代码:
Email.send("from@you.com",
"to@them.com",
"This is a subject",
"this is the body",
"smtp.yourisp.com",
"username",
"password");
首先,如果您有这样的发送按钮
<button id="SendMessage">SEND MAIL</button>
将代码放在页面下面(我也用jquery做到了)
<script src="https://smtpjs.com/v2/smtp.js"></script>
<script>
$("#SendMessage").on("click",function(){
Email.send("from@you.com",
"to@them.com",
"This is a subject",
"this is the body",
"smtp.yourisp.com",
"username",
"password",
function done(message) { alert("This area for after mail send.") }
);
});
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.