About Me

My photo

Father, hacker, partner, feminist, atheist, socialist, SJW. Ex-Russian, Canadian, Québécois par adoption; universal basic income NDP-er (and I vote!); electric-car driving pansy; lapsed artist and photographer.

Abusive comments will be deleted, and abusive posters banned without warning.

Monday, September 28, 2009

SMTP question

I must confess -- I expected that I would have a bit of a rough time configuring my new Thinkpad X200s with F11, but everything worked like magic "out of the box," with no tinkering necessary. I'm blown away!

But, dear lazyweb... I have an SMTP question. I use this laptop both at work and at home -- but I can't use the same SMTP host in both locations. The mailhost at work only allows relaying from internal networks, and doesn't offer "relay if authenticated" service to external addresses (because most people use exchange over mapi, and nobody thus bothers to set up authenticated SMTP relaying for people without outlook). My ISP probably supports authenticated SMTP, but it's silly to use it from work.

VPN is one option, but it's a bit silly to have to start up VPN just to send an email. Ssh or stunnel is another option, but is also sub-optimal. What I really need is a way for a service like ssmtp or esmtp to automatically recognize which network I'm currently on and use either my company's mailhost if I'm at work, or my ISP's mailhost if I'm at home.

My google-fu is failing me. I know ssmtp has "identities" but they aren't very useful in this case because both at home and at work I use the same "from" address. I can't be the only one with this problem. Anyone?


kyle mcmartin said...


You could likely use the ifup/ifdown hooks in /etc/sysconfig/network-scripts to bonk a new config into ssmtp whenever you detect you've come up at home versus at work (presumably based on IP subnet or hostname or something.)

cheers, Kyle

jjmartinez said...

You can use http://msmtp.sourceforge.net/ as MSA.

It support different accounts at the same time, and you can choose between them easily.

Well, that 'easily' actually depends on you mail client.