At work we have a bunch of email addresses that get sent to a large set of users. Since I started, I've always gotten my mail forwarded to my personal email account, which works really well except for these mailing lists that complain that the mail being sent is not coming from the real email address. Seeing as I use Wanderlust and Emacs for my email, I knew there had to be a way to configure things to use my work smtp server for work emails and gmail for the rest. The key was looking at the the 'wl-draft-config-alist' setting. This is a simple list of key/values that get applied when a header or part of the body get matched. In my case, I wanted to match on the From field and send it via the correct smtp server.
Along side the 'wl-draft-config-alist' is the 'wl-templates-alist', which helps to setup a draft with appropriate headers. I should mention that I tried a ton of different settings to get this to work. I'm sure I could have put all this in my .wl file and that would have been enough, but alas that wasn't the case.
The first step is to go ahead and make a couple templates for writing mail. I created a default and an work template that maily just set the 'From' header to the appropriate value. After that I added some code to my 'wl-draft-config-alist' for each account. The the templates I added via customize in Emacs, while the 'wl-draft-config-alist' I was able to add to my .wl file. The latter seemed to fail when adding variables that needed to be changed. Here is an example of what I added:
(setq wl-draft-config-alist
'(
("^From: .*eric@work.com"
(wl-smtp-authenticate-type . "login")
(wl-smtp-posting-user . "eric")
(wl-smtp-posting-server . "webmail.work.com")
(wl-local-domain . "work.com")
(wl-from . "Eric Larson ")
(wl-reply-to . "Eric Larson ")
)
("^From: .*eric@personal.org"
(wl-smtp-authenticate-type . "plain")
(wl-smtp-posting-user . "eric@personal.org")
(wl-smtp-posting-server . "smtp.gmail.com")
(wl-local-domain . "gmail.com")
(wl-from . "Eric Larson ")
(wl-reply-to . "Eric Larson ")
)
))