Adding sender name to email

Tim Williams tim at tdw.net
Fri Sep 1 06:51:55 EDT 2006


On 1 Sep 2006 03:26:12 -0700, gillespie.amanda at gmail.com
<gillespie.amanda at gmail.com> wrote:
> How do I add a Sender name to the emails sent by the following script:
>

>
>         writer = MimeWriter.MimeWriter(out)
>         # set up some basic headers... we put subject here
>         # because smtplib.sendmail expects it to be in the
>         # message body
>         #
>         writer.addheader("Subject", subject)
>         writer.addheader("MIME-Version", "1.0")
>         #

add the line

writer.addheader("From", a_sender_address)

and you should also have

writer.addheader("To", some_recipient_address(es)_as_a_string)

The smtp sender & recipients do not relate to the sender & recipients
in the email itself,  Often they are the same, but they don't have to
be.

HTH :)



More information about the Python-list mailing list