|
Hello,
I am sending an email with smtplib, and i need to get a copy of what i have sent out. Is there a way to do it? I am storing the information into a database so I need to get message id, time etc from the message that gets sent out. Thanks -- Lukasz Szybalski _______________________________________________ Email-SIG mailing list [hidden email] Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com |
|
On Thu, Apr 13, 2006 at 12:47:10PM -0500, Lukasz Szybalski wrote:
> I am sending an email with smtplib, and i need to get a copy of what i > have sent out. Add yourself to the list of recipints addresses. Oleg. -- Oleg Broytmann http://phd.pp.ru/ [hidden email] Programmers don't die, they just GOSUB without RETURN. _______________________________________________ Email-SIG mailing list [hidden email] Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com |
|
In reply to this post by Lukasz Szybalski
On Thu, 2006-04-13 at 12:47 -0500, Lukasz Szybalski wrote:
> I am sending an email with smtplib, and i need to get a copy of what i > have sent out. > Is there a way to do it? > > I am storing the information into a database so I need to get message > id, time etc from the message that gets sent out. Do you want the mail server to send you a copy, or do you want a copy of what you send to the mail server? If the former, just add a BCC header and include the return address you want the copy sent to. If the latter, just do str(msg) to get the text. -Barry _______________________________________________ Email-SIG mailing list [hidden email] Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com |
|
On 4/13/06, Barry Warsaw <[hidden email]> wrote:
> On Thu, 2006-04-13 at 12:47 -0500, Lukasz Szybalski wrote: > > > I am sending an email with smtplib, and i need to get a copy of what i > > have sent out. > > Is there a way to do it? > > > > I am storing the information into a database so I need to get message > > id, time etc from the message that gets sent out. > > Do you want the mail server to send you a copy, or do you want a copy of > what you send to the mail server? If the former, just add a BCC header > and include the return address you want the copy sent to. If the > latter, just do str(msg) to get the text. Although that works to get what i created i also need to get : Date: Thu, 13 Apr 2006 11:11:17 -0700 (PDT) Message-Id: <[hidden email]> Anyway to do it? Does smtplib have a way to return exact thing it is sending? > -Barry > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.2.2 (GNU/Linux) > > iQCVAwUARD6RY3EjvBPtnXfVAQIoFwP9HEayxK92vSYnsv4U9REibulopyFVS/PP > s4NYOkSZdiFhzJvLa5ikLndtWsBlW+7WQcBHjAJQM/Lro15A0OPwwTz/GlMuyRBZ > w3+oJYvA0usfXkyzf599mzWJeDMIVQEn5XI71bCr2A+4d81OdbbZR+B4dc2TyHxE > kokXiQsLVMY= > =UKfv > -----END PGP SIGNATURE----- > > > -- Lukasz Szybalski www.lucasmanual.com _______________________________________________ Email-SIG mailing list [hidden email] Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com |
|
Is message id generated by sending server or receiving server?
I could create a time stamp, but not sure about message id. The easiest way i see it done, is to enter some kind of debug mode that lets me see what is being transferred and enables me to get a copy of sent message. Lukasz On 4/13/06, Lukasz Szybalski <[hidden email]> wrote: > On 4/13/06, Barry Warsaw <[hidden email]> wrote: > > On Thu, 2006-04-13 at 12:47 -0500, Lukasz Szybalski wrote: > > > > > I am sending an email with smtplib, and i need to get a copy of what i > > > have sent out. > > > Is there a way to do it? > > > > > > I am storing the information into a database so I need to get message > > > id, time etc from the message that gets sent out. > > > > Do you want the mail server to send you a copy, or do you want a copy of > > what you send to the mail server? If the former, just add a BCC header > > and include the return address you want the copy sent to. If the > > latter, just do str(msg) to get the text. > > Although that works to get what i created i also need to get : > Date: Thu, 13 Apr 2006 11:11:17 -0700 (PDT) > Message-Id: <[hidden email]> > > Anyway to do it? Does smtplib have a way to return exact thing it is sending? > > > -Barry > > > > > > > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.4.2.2 (GNU/Linux) > > > > iQCVAwUARD6RY3EjvBPtnXfVAQIoFwP9HEayxK92vSYnsv4U9REibulopyFVS/PP > > s4NYOkSZdiFhzJvLa5ikLndtWsBlW+7WQcBHjAJQM/Lro15A0OPwwTz/GlMuyRBZ > > w3+oJYvA0usfXkyzf599mzWJeDMIVQEn5XI71bCr2A+4d81OdbbZR+B4dc2TyHxE > > kokXiQsLVMY= > > =UKfv > > -----END PGP SIGNATURE----- > > > > > > > > > -- > Lukasz Szybalski > www.lucasmanual.com > -- Lukasz Szybalski www.lucasmanual.com _______________________________________________ Email-SIG mailing list [hidden email] Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com |
|
In reply to this post by Lukasz Szybalski
[Sorry, originally sent this reply directly]
Dear Lukasz, > Is message id generated by sending server or receiving server? It's intended to be created by the program that sends the mail, but it's technically optional. The details are at: http://www.faqs.org/rfcs/rfc2822.html If the sending program doesn't create a Message-ID header, one will likely be added by some intermediate server. > I could create a time stamp, but not sure about message id. Python's email module has a convenience function to create one that should be sufficient. It's documented at: http://docs.python.org/lib/module-email.Utils.html For example: >>> import email.Utils >>> email.Utils.make_msgid() '<[hidden email]>' Regards, Matt _______________________________________________ Email-SIG mailing list [hidden email] Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com |
|
In reply to this post by Lukasz Szybalski
Lukasz Szybalski wrote:
> >Although that works to get what i created i also need to get : >Date: Thu, 13 Apr 2006 11:11:17 -0700 (PDT) >Message-Id: <[hidden email]> > >Anyway to do it? Does smtplib have a way to return exact thing it is sending? smtlib sends exactly what you give it. If you don't put Date: and Message-Id: headers in the message you pass to smtplib, your outgoing MTA adds them and the smtplib methods have no way to know what they are. If your application needs to know them, it has to create them and put them in the message as suggested by Matthew in another reply. -- Mark Sapiro <[hidden email]> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan _______________________________________________ Email-SIG mailing list [hidden email] Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com |
|
Mark Sapiro wrote:
>Lukasz Szybalski wrote: >> >>Although that works to get what i created i also need to get : >>Date: Thu, 13 Apr 2006 11:11:17 -0700 (PDT) >>Message-Id: <[hidden email]> >> >>Anyway to do it? Does smtplib have a way to return exact thing it is sending? > >smtlib sends exactly what you give it. If you don't put Date: and >Message-Id: headers in the message you pass to smtplib, your outgoing >MTA adds them and the smtplib methods have no way to know what they >are. Actually, I looked a little more closely, and in your particular case above it seems that at least the Message-Id: header was not added until the message reached gmail.com. -- Mark Sapiro <[hidden email]> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan _______________________________________________ Email-SIG mailing list [hidden email] Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com |
|
In reply to this post by Lukasz Szybalski
On 4/13/06, Matthew Dixon Cowles <[hidden email]> wrote:
> Dear Lukasz, > > > Is message id generated by sending server or receiving server? > > It's intended to be created by the program that sends the mail, but > it's technically optional. The details are at: > > http://www.faqs.org/rfcs/rfc2822.html > > If the sending program doesn't create a Message-ID header, one will > likely be added by some intermediate server. > > > I could create a time stamp, but not sure about message id. > > Python's email module has a convenience function to create one that > should be sufficient. It's documented at: > > http://docs.python.org/lib/module-email.Utils.html > > For example: > > >>> import email.Utils > >>> email.Utils.make_msgid() > '<[hidden email]>' > One last question. Is there an easy way to covert body of an email into lines starting with ">" If I received in my payload(), body of an email: hello how are you I want to send a response with quoted part: hi >hello >how are you Is quote(str) a function that i would use? From description it seems as it only escapes backslashes and quotes. Thank you Lukasz > Regards, > Matt > > _______________________________________________ Email-SIG mailing list [hidden email] Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com |
|
On Fri, Apr 14, 2006 at 12:12:50PM -0500, Lukasz Szybalski wrote:
> One last question. > Is there an easy way to covert body of an email into lines starting with ">" > > If I received in my payload(), body of an email: > hello > how are you > > I want to send a response with quoted part: > hi > >hello > >how are you body = message.get_payload() answer = ["> %s" % line for line in body.split('\n')] reply = '\n'.join(answer) Oleg. -- Oleg Broytmann http://phd.pp.ru/ [hidden email] Programmers don't die, they just GOSUB without RETURN. _______________________________________________ Email-SIG mailing list [hidden email] Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com |
|
In reply to this post by Lukasz Szybalski
Dear Lukasz,
> Is there an easy way to covert body of an email into lines starting > with ">" Oleg is of course quite right. Depending on your exact needs, you may also find the textwrap module useful: http://docs.python.org/lib/module-textwrap.html Regards, Matt _______________________________________________ Email-SIG mailing list [hidden email] Your options: http://mail.python.org/mailman/options/email-sig/lists%40nabble.com |
| Powered by Nabble | Edit this page |
