如何使用 SMTP 在 ionic 3 中发送电子邮件?
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 以使用此代码:
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>
我正在尝试使用 Gmail SMTP 发送电子邮件。我检查了很多解决方案,但没有任何效果。
今天我发现这个网站 https://www.smtpjs.com/ 可以帮助我解决我的问题,但我需要帮助才能知道我应该把这个 HTML 行放在哪里:
<script src="https://smtpjs.com/v2/smtp.js"></script>
那么我如何在我的 home.ts 中导入 Email 以使用此代码:
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>