Ruby
Ruby vous permet d'envoyer simplement des emails en SMTP grâce à une librairie : mail
Pour installer mail, nous allons utiliser gem.
gem install mail
Vous pouvez maintenant utiliser la librairie dans votre application. Voici un exemple de code que vous pouvez adapter
/*
* File Name : send.rb
* Task : send email through Tipimail
*/
require 'mail'
Mail.defaults do
delivery_method :smtp, {
:port => 587,
:address => "smtp.tipimail.com",
:user_name => "username",
:password => "password"
}
end
mail = Mail.deliver do
from 'contact@mail.tipimail.com'
to 'to@mail.tipimail.com'
subject 'sujet de votre email'
text_part do
body 'Message au format texte'
end
html_part do
content_type 'text/html; charset=UTF-8'
body 'Message au format html'
end
end
Il ne vous reste plus qu'à appeler votre script
ruby send.rb