Skip to content

Latest commit

 

History

History
executable file
·
37 lines (34 loc) · 727 Bytes

README.md

File metadata and controls

executable file
·
37 lines (34 loc) · 727 Bytes

smtpmailer

Runs on sys targets and nodejs. Requires haxe 4+

final email = {
  subject: 'Subject',
  from: {address: '[email protected]', displayName: "It's me, Mario!"},
  to: [{address:'[email protected]', displayName:"Luigi Plumber"}],
  content: {
    text: 'hello',
    html: '<font color="red">hello</font>'
  },
  attachments: ['image.png']
}

smtpmailer.SmtpMailer.connect({
  host: 'hostname',
  port: 587,
  auth: {
    username: 'user',
    password: 'pass'
  }
}).next(mailer ->
  mailer.send(email).next(
    _ -> mailer.close()
  )
).handle(function(res) {
  switch res {
    case Success(_):
      trace('Email sent!');
    case Failure(e): {
      trace('Something went wrong: '+e);
    }
  }
});