(更新)こんにちはすべて私はNodejs
を使用してメールに送信された友人を招待したい。主にサーバー側user
とpass
を使用できますか?メールはまた、私は多くの方法を試してみました、その後送られたが、いずれかの解決策を知っていれば解を得ることができないことができない私を助けてください..... myplunkerどのように友人に招待メールに送信?
HTML: -
<div id="container">
<center>
<input id="to" type="text" placeholder="Enter E-mail ID" /><br><br>
<input id="subject" type="text" placeholder="Write Subject" /><br><br>
<textarea id="content" cols="40" rows="5" placeholder="Message"></textarea><br><br>
<button id="send_email">Send Email</button>
</center>
<span id="message"></span>
</div>
サーバー: -
var smtpTransport = nodemailer.createTransport("SMTP",{
service: "Gmail",
use_authentication: true,
auth: {
user: "[email protected]",
pass: "password"
}
});
app.get('/',function(req,res){
res.sendfile('index.html');
});
app.get('/send',function(req,res){
var mailOptions={
to : req.query.to,
subject : req.query.subject,
text : req.query.text
}
console.log(mailOptions);
smtpTransport.sendMail(mailOptions, function(error, response){
if(error){
console.log(error);
res.end("error");
}else{
console.log("Message sent: " + response.message);
res.end("sent");
}
});
});
メールを送信するには、サーバーの一部が必要です – Alexan
私はangularjsを初めて使用しています。サーバの部分の解決策があれば教えてください。 –
おそらく最も簡単な方法はPHPで送信することです。 [ここ](http://php.net/manual/es/function.mail.php)と[ここ](http://www.w3schools.com/php/func_mail_mail.asp)で確認してください。 –