keropposters.blogg.se

Mac os x shell script send email using sendmail via gmail
Mac os x shell script send email using sendmail via gmail










  1. #Mac os x shell script send email using sendmail via gmail mac os x
  2. #Mac os x shell script send email using sendmail via gmail install
  3. #Mac os x shell script send email using sendmail via gmail full
  4. #Mac os x shell script send email using sendmail via gmail password
  5. #Mac os x shell script send email using sendmail via gmail download

Voilà! After a few fairly simple configuration steps, you can now use "Mail" or invoke msmtp directly (see "msmtp -help" for details). The first time you run it, you will get a Keychain authorization request for msmtp.

#Mac os x shell script send email using sendmail via gmail full

Use your full Gmail address for both and you ought to be safe.Įcho "Hello world" | Mail -s "msmtp test at `date`" you have a 2nd email account, use that instead of emailing it to your own Gmail account.) Note that the "Account Name" in Keychain must match the "account" listed in msmtprc exactly.

mac os x shell script send email using sendmail via gmail

#Mac os x shell script send email using sendmail via gmail password

Set sendmail="/Users/yourusername/Dropbox/bin/msmtp"īe sure to change "yourusername" to whatever your login name is on your Mac.ħ) Launch "/Applications/Utilities/Keychain Access.app/" and create a new password item (File » New Password Item) that looks like this. # You need to set a default account for MailĦ) Create a ~/.mailrc file including the full path to msmtp on your system (again, this is for Mail). Tls_trust_file ~/Dropbox/Thawte Roots/Thawte SSLWeb Server Roots/thawte Premium Server CA/Thawte Premium Server CA.pem # This next line should all be on one long line: # If this doesn't work, check the mstmp documentation # this next line is crucial: you have to point to the correct security certificate for GMail. # Set default values for all following accounts. Replace with your Gmail address wherever shown. For our purposes I am going to assume that you want to use a Gmail account to send. This is where the benefits over mailsend start to become apparent, as you can define several different accounts if you wish. I saved the file "thawte-roots.zip" to ~/Dropbox/ and then double-clicked to open/unarchive it.ĥ) The ~/Dropbox/etc/msmtprc (or /usr/local/etc/msmtprc) file is a system-wide configuration file for using mstmp. I was not sure if these were already installed somewhere and wanted to make sure I had current information, so I went to and downloaded the latest version (you have to fill out a simple web form). It should complete without error.Ĥ) You need to have security certificates installed locally. configure -prefix=/usr/local/ -with-ssl=openssl -with-macosx-keyringģ) Once that has finished, type "make install". If you do not want to use Dropbox for this, I recommend using this instead: Dropbox does not save file permissions, so I also have my shell configuration file (.zshrc) run " chmod 755 ~/Dropbox/bin/*" every time a new shell is opened.

#Mac os x shell script send email using sendmail via gmail install

Note: if you install to Dropbox, binaries are placed in ~/Dropbox/bin/ which you will need to add to your $PATH. configure -prefix=$HOME/Dropbox/ -with-ssl=openssl -with-macosx-keyring I actually chose to install it to my ~/Dropbox/ folder so all of my computers would have access to it and use the same configuration file, so I also added "-prefix=$HOME/Dropbox/" which made my "configure" command look like this:

#Mac os x shell script send email using sendmail via gmail mac os x

In order to compile the app from source, you will need to have the Mac OS X Developer Tools (Xcode) installed.Ģ) Run "./configure" being sure to use the "-with-ssl=openssl" and "-with-macosx-keyring" options.

#Mac os x shell script send email using sendmail via gmail download

You might not share my neuroses, however.)ġ) Download and unarchive the source from ("msmtp-1.4.20.tar.bz2" is the current version as of this writing). (You can also get mstmp from Rudix or MacPorts but I still like building my own whenever possible. In short: msmtp was what I was looking for when I found mailsend.Īlthough configuring msmtp took about 30 minutes, it was well worth it, and now that you have these handy instructions, it should take you even less time than it took me. (Note I said "nearly" - this is not a challenge!)

mac os x shell script send email using sendmail via gmail

Once msmtp is configured, I can use the venerable "/usr/bin/Mail" to send email from the command line, and /usr/bin/Mail is nearly idiot proof.

mac os x shell script send email using sendmail via gmail

The other big advantage is that mailsend required several command line arguments every time, which makes it very likely that someone (i.e. msmtp uses the Mac OS X Keychain instead. What makes msmtp so great, especially compared to mailsend, is that it completely eliminates the need to store your Gmail password in a plain text file on your computer. Suggestions included Ruby, Python, iPhone push notifications, and configuring postfix/sendmail.īut one suggestion was to use msmtp, and that turned out to be the golden nugget. I fully expected that my article on mailsend would lead to several "Why don't you use use XYZ instead?" replies, and it did.












Mac os x shell script send email using sendmail via gmail