My email setup consists of fetchmail, procmail, mutt, nbsmtp and msmtpqueue.
Setting up fetchmail and procmail is not really a problem, there are umpteen guides on the net.
Sending mail is a little harder. I don't use sendmail/qmail etc. since they're far too advanced for my needs, and I have no idea how to set them up. Instead I go for small smtp programs such as msmtp, esmtp or nbsmtp.
msmtp and esmtp wouldn't work. I have no idea what was wrong, instead I just gave up and installed nbsmtp, which works fine. I set up mutt with "sendmail = 'nbsmtp -h smtp.gmail.com -p 465 -U username@gmail.com ...'" and it sent mails through gmail just great.
The next thing to do was set up so that I could switch at will between gmail accounts when I compose and email. This is a case of constructing a macro in mutt which changes the sendmail option to pass different option to nbsmtp (i.e. a different username and password), and also change the from address in the headers.
I came up with a line which looked a little like this:
macro compose \e1 "\ef^uJoe Bloggs\n
set sendmail='/usr/local/bin/nbsmtp -f joebloggs1@gmail.com -h smtp.g
mail.com -p 465 -s -U joebloggs1@gmail.com -P joespassword'" 'choose
Joe Bloggs smtp profile'
I'll dissect it bit by bit:
macro - this is a macro...
compose - it works if you're on the compose screen (the one after typing your mail but before sending it)
\e1 - it's activated when you type escape, then 1
"\ef^uJoe Bloggs\n - this changes the from header to "Joe Bloggs ". (escape f means change the from line, control u clears it, then Joe... \n is equivalent to typing it in followed by enter.)
set sendmail='/usr/local/bin/nbsmtp -f joebloggs1@gmail.com -h smtp.g
mail.com -p 465 -s -U joebloggs1@gmail.com -P joespassword' - this simply changes the sendmail option to nbsmtp...
'choose Joe Bloggs smtp profile' - the text to display in the help screen
I have a line like this for each email address I will be sending mail from.
The final part of the email setup is set up msmtpqueue scripts so that it doesn't matter if I'm online when I send email in mutt.
The scripts are set up for use with msmtp, but it works with nbsmtp if you simply change the relevant line. I also changed the names of the files, folders, variables etc. from *msmtp* to *nbsmtp* to avoid confusing myself.
Now mutt sends mail to the msmtpqueue script ("sendmail=/usr/local/bin/nbsmtp-queue -h smtp.gmail.com etc."), with the same options as before (they are passed onto nbsmtp). If the internet connection is up (tested by pinging google, probably not the best way) it runs the sendmail script straight away. If not, the sendmail script runs every 5 minutes as a cronjob, so the mail just sits in the queue until the net is up and then gets sent.
Setting up fetchmail and procmail is not really a problem, there are umpteen guides on the net.
Sending mail is a little harder. I don't use sendmail/qmail etc. since they're far too advanced for my needs, and I have no idea how to set them up. Instead I go for small smtp programs such as msmtp, esmtp or nbsmtp.
msmtp and esmtp wouldn't work. I have no idea what was wrong, instead I just gave up and installed nbsmtp, which works fine. I set up mutt with "sendmail = 'nbsmtp -h smtp.gmail.com -p 465 -U username@gmail.com ...'" and it sent mails through gmail just great.
The next thing to do was set up so that I could switch at will between gmail accounts when I compose and email. This is a case of constructing a macro in mutt which changes the sendmail option to pass different option to nbsmtp (i.e. a different username and password), and also change the from address in the headers.
I came up with a line which looked a little like this:
macro compose \e1 "\ef^uJoe Bloggs
set sendmail='/usr/local/bin/nbsmtp -f joebloggs1@gmail.com -h smtp.g
mail.com -p 465 -s -U joebloggs1@gmail.com -P joespassword'
Joe Bloggs smtp profile'
I'll dissect it bit by bit:
macro - this is a macro...
compose - it works if you're on the compose screen (the one after typing your mail but before sending it)
\e1 - it's activated when you type escape, then 1
"\ef^uJoe Bloggs
mail.com -p 465 -s -U joebloggs1@gmail.com -P joespassword'
'choose Joe Bloggs smtp profile' - the text to display in the help screen
I have a line like this for each email address I will be sending mail from.
The final part of the email setup is set up msmtpqueue scripts so that it doesn't matter if I'm online when I send email in mutt.
The scripts are set up for use with msmtp, but it works with nbsmtp if you simply change the relevant line. I also changed the names of the files, folders, variables etc. from *msmtp* to *nbsmtp* to avoid confusing myself.
Now mutt sends mail to the msmtpqueue script ("sendmail=/usr/local/bin/nbsmtp-queue -h smtp.gmail.com etc."), with the same options as before (they are passed onto nbsmtp). If the internet connection is up (tested by pinging google, probably not the best way) it runs the sendmail script straight away. If not, the sendmail script runs every 5 minutes as a cronjob, so the mail just sits in the queue until the net is up and then gets sent.

<< Home