My Colleague was working on having auto scripts to send mail through "mutt" with backup attachment.
But he was not able get it up, so though of looking into this.
Wondering what "mutt" is go here then :)
Here is what I did to get it working.
you need to send the first mail from the "mutt client" so that it takes the certificate from the server.
 
use
$ mutt
This will bring up the mutt interface - send your test mail from here.
Once that is done. You are all set to use the script.
To test - run the below command in your command prompt.
$ mutt --help
$ mutt -s "Hello Test from the shell Script :)" zubair.ahmed@emailid.com < /dev/null -a <attach a File here>
NOTE for .muttrc
# Non Google App users can just enter the username without the domain name like below.
#set smtp_url = "smtp://zubair.ahmed@smtp.gmail.com:587/"
# To use google apps make sure your email account is transitioned - check with our Google Email Administrator
set smtp_url = "smtp://zubair.ahmed@domainName.com@smtp.gmail.com:587/"
set smtp_pass = "yourDomainPassword"
But he was not able get it up, so though of looking into this.
Wondering what "mutt" is go here then :)
Here is what I did to get it working.
- If you need to configure anything for mutt first look for .muttrc in your home directory ~/.muttrc
- If its not there you can create one.
- I have attached my .muttrc file you can use to configure your mutt. (change the email and password)
- Just download the dot.muttrc and save it as .muttrc in your home directory (/home/ahmed).
- Also create directory in the path below
- mkdir -p ~/.mutt/cache/headers
- mkdir -p ~/.mutt/cache/bodies
- mkdir -p ~/.mutt/certificates
you need to send the first mail from the "mutt client" so that it takes the certificate from the server.
use
$ mutt
This will bring up the mutt interface - send your test mail from here.
Once that is done. You are all set to use the script.
To test - run the below command in your command prompt.
$ mutt --help
$ mutt -s "Hello Test from the shell Script :)" zubair.ahmed@emailid.com < /dev/null -a <attach a File here>
NOTE for .muttrc
# Non Google App users can just enter the username without the domain name like below.
#set smtp_url = "smtp://zubair.ahmed@smtp.gmail.com:587/"
# To use google apps make sure your email account is transitioned - check with our Google Email Administrator
set smtp_url = "smtp://zubair.ahmed@domainName.com@smtp.gmail.com:587/"
set smtp_pass = "yourDomainPassword"

Comments
Post a Comment