2008 / SSID-based SMTP server changer for
SSID-based SMTP server changer for Evolution
This is a simple Python script that utilizes gconf and
NetworkManager (via D-Bus) to check which wireless network (SSID) you
are currently connected to, and updates Evolution's accounts list (in
gconf) to point to the correct SMTP server for that network.
This should come in handy when you roam between two (or more) wireless
networks and these networks are connected to different ISPs. In my
case, these are aon
and Silver Server
, and sending e-mail from
each network only works when the ISP-specific SMTP server is configured
in the sending e-mail settings for each account.
On Maemo, we already have this setting (you can specify the
SMTP server based on the SSID of the wireless network, and the Internet
Tablet knows how to send E-Mails). I've filed a bug report (Bug 510909:
Default SMTP server based on NetworkManager SSID) against Evolution
in Gnome's bug tracker, but got no reaction so far.
Lorenzo Milesi discovered that
the D-BUS API of NetworkManager has changed in version 0.7. This
means that this script does not currently work. Lorenzo is looking for
updated API docs, so we can update this script.
Here is some information about API changes
from Dan Williams about the new API.
You can start the script by running
but you probably want to configure it first. You should run
to show the current SSID and SMTP
server, and you can copy the given line directly to the script, i.e.
dict. Don't forget to remove the
examples in the script ;)
When you are at another location, set the correct SMTP
settings in Evolution and re-run the "identify" command to give you the
correct line for this network, and also add it to the dict. After you
have set up all your networks and SMTP servers this way, you simply run
the script (
python evolution-smtp.py) and it will check if
the SMTP server settings need to be updated and give you a (hopefully)
clear notification what has been done or what went wrong :) If the
RUN_AS_DAEMON is set to
evolution-smtp will continue to run in the background and will re-run
whenever NetworkManager's interface status changes.
- Specifying an SMTP server (+advanced settings, like SSL,
TLS, etc..) per SSID
- Specifying a fallback SMTP server when not connected to
wireless (i.e. wired)
- Running as background process/daemon, watching for network
and account changes
What doesn't work
- No GUI to configure (have to use "--identify" and add
SMTP/SSID pairs to script)
- Specifying which accounts to update the SMTP server for
(currently, all are updated)
- Changin SMTP server based on wired network properties (i.e.
assigned IP, etc..)
- BSD-style (see the source file)
- python (tested w/ Python 2.5)
- python-xml (or at least xml.dom.minidom)
Helpful links to library documentation
Thomas Perl (m at thp io), jabber: