2015年1月18日 星期日

send mail via Gmail from command line

# apt-get install heirloom-mailx 
 
$ vi ~/.mailrc
account gmail {
set smtp-use-starttls
set smtp=smtp://smtp.gmail.com:587
set smtp-auth=login
set smtp-auth-user=%REPLACE WITH YOUR E-MAIL ACCOUNT%
set smtp-auth-password=%REPLACE WITH YOUR PASSWORD%
set from=%NAME YOUR E-MAIL SOURCE. NO SPACES%
}
 
 
$ echo "Test Email" | mailx -v -A gmail -s "test" whereshouldIsendthisemail@domain.com 




References :
Can’t send e-mail from the Ubuntu command line – mailx: invalid option — ‘A’

沒有留言:

張貼留言