Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: Subject line with smtplib.sendmail()

Reply
Thread Tools

RE: Subject line with smtplib.sendmail()

 
 
Boudreau, Emile
Guest
Posts: n/a
 
      03-20-2007
Thanks for the reply. When I use the instruction from that list this is
the email I receive. I'm using Outlook.

http://www.velocityreviews.com/forums/(E-Mail Removed)
To:
------------------------------
From: (E-Mail Removed)
To: (E-Mail Removed)
Subject: Hello!

This Still DOESN't Work!!!!!!!!!!!!

It's just adding the "From" "To" "Subject" in the message itself. I want
to have each field at the correct place and then just the msg in the
body.

Any Help?? Thanks


Emile Boudreau


-----Original Message-----
From: python-list-bounces+emile.boudreau=(E-Mail Removed)
[mailtoython-list-bounces+emile.boudreau=(E-Mail Removed)] On
Behalf Of Fredrik Lundh
Sent: Tuesday, March 20, 2007 11:08 AM
To: (E-Mail Removed)
Subject: Re: Subject line with smtplib.sendmail()

Boudreau, Emile wrote:

> I'm trying to send mail from my server to my machine with test
> results. I can send the email no problem however, the email doesn't
> contain a "recipient list" or a "subject line". I was wondering how
> would I go about getting the information on the actual "To" and
> "Subject" lines so that I know to whom the email was sent and the
> subject line without opening the email?


you have to add the headers yourself. see the example in the library
reference, or this FAQ entry:

http://effbot.org/pyfaq/how-do-i-sen...-python-script

</F>



--
http://mail.python.org/mailman/listinfo/python-list

This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you.
 
Reply With Quote
 
 
 
 
kyosohma@gmail.com
Guest
Posts: n/a
 
      03-20-2007
On Mar 20, 12:50 pm, "Boudreau, Emile" <(E-Mail Removed)>
wrote:
> Thanks for the reply. When I use the instruction from that list this is
> the email I receive. I'm using Outlook.
>
> (E-Mail Removed)
> To:
> ------------------------------
> From: (E-Mail Removed)
> To: (E-Mail Removed)
> Subject: Hello!
>
> This Still DOESN't Work!!!!!!!!!!!!
>
> It's just adding the "From" "To" "Subject" in the message itself. I want
> to have each field at the correct place and then just the msg in the
> body.
>
> Any Help?? Thanks
>
> Emile Boudreau
>
> -----Original Message-----
> From: python-list-bounces+emile.boudreau=(E-Mail Removed)
>
> [mailtoython-list-bounces+emile.boudreau=(E-Mail Removed)] On
> Behalf Of Fredrik Lundh
> Sent: Tuesday, March 20, 2007 11:08 AM
> To: (E-Mail Removed)
> Subject: Re: Subject line with smtplib.sendmail()
>
> Boudreau, Emile wrote:
>
> > I'm trying to send mail from my server to my machine with test
> > results. I can send the email no problem however, the email doesn't
> > contain a "recipient list" or a "subject line". I was wondering how
> > would I go about getting the information on the actual "To" and
> > "Subject" lines so that I know to whom the email was sent and the
> > subject line without opening the email?

>
> you have to add the headers yourself. see the example in the library
> reference, or this FAQ entry:
>
> http://effbot.org/pyfaq/how-do-i-sen...-python-script
>
> </F>
>
> --http://mail.python.org/mailman/listinfo/python-list
>
> This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you.


I'm not sure what the problem is. But here's how we do it at my place
of work:


import smtplib
import string

def sendMail(subject, body, TO = "(E-Mail Removed)",
FROM="(E-Mail Removed)"):
HOST = "mailserver"
BODY = string.join((
"From: %s" % FROM,
"To: %s" % TO,
"Subject: %s" % subject,
"",
body
), "\r\n")
server = smtplib.SMTP(HOST)
server.sendmail(FROM, [TO], BODY)
server.quit()


This works well for us.

Mike

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
UTF8 characters not appearing correctly in email subject line Andee Weir Java 10 08-13-2007 09:02 PM
Making Font Size Large on Message "Subject"Line Pane Herb Firefox 0 12-07-2005 01:54 AM
No Subject for this subject George MCAD 0 05-20-2005 10:19 AM
Add/Remove Programs Help Kinda Wierd Do Not Ignore Terrable Subject JustIgnore The Subject Oops Whatever Duh Samuel Townsend Computer Support 0 10-13-2004 12:49 AM
mailto: subject line Chuck HTML 28 09-04-2003 12:24 AM



Advertisments