LoginSignup
12
12

More than 5 years have passed since last update.

node.jsでメール送信機能

Last updated at Posted at 2015-01-16

nodemailerを使用

とりあえず、nodemailerのインストール。
$ npm install nodemailer

今回は、routesディレクトリ以下のuser.js(任意)にメール送信のコードを記述

user.js

exprorts.mail = function(req,res){
  var nodemailer = require('nodemailer');
  var transport = nodemailer.createTransport();
    
    
    
  transport.sendMai({
    from : 'hoge1',
    to   : 'fuga1',
    cc   : 'hoge2',
    subject : 'huga2',
    text :  "hogehoge"
  });

node.jsはこれだけでOK.
※kobito for windowsで編集してみる。

12
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
12