New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
sending email with mandrillapp API and bash
https://raw.githubusercontent.com/blackdotsh/mandrillapp-cli/master/sendmail.sh
I made this because I got tired of setting up mail(x) / sendmail.
Benefits:
- Usually you get your mail delivered right to your inbox and doesn't get marked as spam. With the default settings of mail(x), that usually doesn't happen.
- Uses http / curl instead of smtp so it'll bypass firewalls blocking it.
- Less pain in the ass to setup.
I'm currently using it for login notifications / notifications on server statuses that's being directly sent to my SMS email. Surely someone will find this useful.
Instructions:
1) Just edit the bash file, put in your mandrillapp key along with the sender's credentials (be sure to setup sending domains).
2)
chmod u+x sendmail.sh
3)
./sendmail.sh "[email protected]" "hello" "this is from the command line!"
Enjoy
Comments
Great, thanks!
I lovee you! Gee I was thinking about this today.
I don't think this will solve all your problems if you don't take care of correct DKIM and SPF records for the domain(s) you are sending from. You can check the sending domains using the Mandrill dashboard.
As long as your sender domain / subdomain is set up correctly in mandrillapp, it works fine. That's a one time thing though, much less painful than sendmail / postfix / etc.
I don't think there is much difference between using Mandrill SMTP and the API, but I might be wrong.
You could consider using nullmailer, a lightweight queuing MTA (outbound only), see here for setup instructions: http://blog.bokhorst.biz/6507/computers-and-internet/how-to-setup-a-vps-as-web-server/#setup_email
I wish things like Zimbra and other things like it allowed for an SMTP through mandrill app.. would eliminate the worry of needing to get your ip into people's whitelists.
I got tired of messing with programs and configs so I stayed away from SMTP in general. The API is via HTTP so most networks will allow the traffic as some public networks might block SMTP traffic. Overall, it was just easier to mess with than SMTP and it's applications.
SMTP is pretty standard, so you can easily switch providers. The Mandrill API is pretty custom ....
I tried the standard way and I failed lol. I'll spin up a DO instance or something later and try it again.
Great Tutorial. Thanks !
Here's a script that I use to get Mandrill and SendGrid working with sendmail out of the box. Just edit to fit your settings, save it as a .sh file, and run it once when you setup your server (replace yum with apt-get for Debian/Ubuntu). Works every time and even sends you a test e-mail at the end.
EDIT: Decided to clean up my script and make it more "official" looking. You can see it here with comments and formatting: https://github.com/KuJoe/Sendmail-to-SSMTP