Nikos, if you can't use the smtp server at mail.superhost.gr, or if that
has the same restrictions I may have a solution for you. This is a bit
off-topic on the Python list/group, s I will throw in a line of Python
code to make it on-topic
I suppose you have the following reasons to want to have the original
email address in the message: (1) so that you can see who sent the
message, (2) so that you can reply to the original sender.
Let's say that the from address was (e-mail address removed)
Problem 1 can be solved in two ways:
(a) Just put the email address in front of the subject line, like:
Subject: (From (e-mail address removed)) Original subject line
(b) This solution is a bit more tricky.
- Get a separate email address that you use for these messages, like
(e-mail address removed). Register this as one of your email addresses in
gmail. For this it must be a real email address that belongs to you,
not a fake address. When it is registered with gmail, gmail will not
change it if found in a From header. Make sure that Thunderbird DOES
NOT KNOW that this email address belongs to you (i.e. don't use this
email address for normal work). Gmail will send you a message to this
address to verify that it belongs to you so you must access it through
some other means, like a web interface.
- Now in the generated email you put the original sender in the comment
and your new email address as the real address like:
From: "(e-mail address removed)" <
[email protected]>
Because Thunderbird doesn't know (e-mail address removed) it will display the
other one, (e-mail address removed). Make sure that the email address doesn't
contain a quote character. Better still check that only legal characters
are used.
Problem 2 can easily be solved by adding a Reply-To header with the
original from address. Gmail will not change this.
So the code becomes something like:
MESSAGE = "From: \"{0}\" <
[email protected]>\r\n" "Reply-To: {0}\r\n" "To: {1}\r\n" "Subject: (From {0}) {2}\r\n\r\n{3}\r\n".format(FROM, TO, SUBJECT, MESSAGE)
In my opinion a better solution would be to filter your mesaage through
procmail or similar on your receiving computer. For example put the from
address in an X-From header and let the filter replace the From header
with the address from the X-From.