473,503 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Regarding Mail sending smtplib Module



Dear All,

I have doubt regarding mail sending smtplib
module. The below code is I used to send a mail.

##########################################
import email.Message
import email.Utils
import mimetypes
import os,string

fromAddr="pr******@enmail.com"
toAddr=
["pr**********@rediffmail.com","pr***@enmail.co m"]

mainMsg=email.Message.Message()
mainMsg["Date"]=email.Utils.formatdate(localtime=1)
mainMsg["Subject"]="en new contents"
mainMsg["From"]=fromAddr
mainMsg["To"]= string.join(toAddr,",")

## I am sending below message ## here

mainMsg.set_payload("Good to win win\n")

server = smtplib.SMTP('localhost')
server.set_debuglevel(1)
server.sendmail(fromAddr, toAddr, mainMsg.as_string())
server.quit()

######################

This is the output of above send mail program.

Here I want to avoid this line "Received: from unknown
(HELO prabahar.enmail.com) (59.92.13.47) by
mailserver with SMTP; 11 May 2005 10:09:11 -0000 " How
can I do this? . Why python give this line? . Mail
sending Module in php will not give this type line.
Here I have another doubt Php mail sending module give
MessageId automatically
but python doesn't set that. why?

output
*******

Return-Path: <pr******@enmail.com>
Delivered-To: pr**********@rediffmail.com
Received: (qmail 6865 invoked from network); 11 May
2005 10:09:11 -0000
Received: from unknown (HELO prabahar.enmail.com)
(59.92.13.47) by mailserver with SMTP; 11 May 2005
10:09:11 -0000

Received: (dqd 1118 invoked from network); 12 Apr 2005
06:38:59 -0000
Received: from unknown (HELO prabahar.enmail.com)
(127.0.0.1)
by prabahar.enmail.com with SMTP; 12 Apr 2005 06:38:59
-0000
Date: Tue, 12 Apr 2005 03:38:59 -0300
Subject: en new contents
From: pr******@enmail.com
To: pr**********@rediffmail.com,pr***@enmail.com

Good to win win
with regards
Prabahar

__________________________________________________ ______________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony
Jul 19 '05 #1
1 3180
praba kar <pr*********@yahoo.co.in> wrote:
Here I want to avoid this line "Received: from unknown
(HELO prabahar.enmail.com) (59.92.13.47) by
mailserver with SMTP; 11 May 2005 10:09:11 -0000 " How
can I do this? . Why python give this line? . Mail
sending Module in php will not give this type line.
To quote http://docs.python.org/lib/SMTP-objects.html :
"The SMTP[sic] does not modify the message headers in any way."
The Received: header is being added by your SMTP server. Goodness
knows how PHP avoids it -- direct use of sendmail maybe?
Here I have another doubt Php mail sending module give
MessageId automatically
but python doesn't set that. why?


Because "The SMTP[sic] does not modify the message headers in
any way." Or, to look at it another way, there are obvious
advantages to having message ids created by the client app
rather than the library. (OTOH, the library author is more
likely to write better id-producing code than the average
client app author, but IMHO this is outweighed by the greater
utility of having the app do it and the consistency of not
having SMTP touch the headers.) If PHP mail adds a message id,
that would be consistent with it using sendmail rather than
talking directly to the SMTP server.

--
\S -- si***@chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomež se bera eadward ofdun hlęddre heafdes bęce bump bump bump
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
25370
by: Alex Hunsley | last post by:
I am using the smtp module to send emails via a local SMTP server on our network. I am failing with "connection refused" error, even though we definitely have an smtp server running on port 25! ...
3
1625
by: praba kar | last post by:
Dear All, In Php we can do all the mailing operations like sending a text as a message, adding attachment to a mail, adding additional headers and so on using Mail_mime class. I want to know...
0
522
by: praba kar | last post by:
Dear All, I have doubt regarding mail sending smtplib module. The below code is I used to send a mail. ########################################## import email.Message import email.Utils...
1
1728
by: praba kar | last post by:
Dear All, Is it possible to send a message as a mail with out smtplib module? If you find out any module for mail sending(without smtplib) kindly mail me. regards Prabahar
9
3101
by: Leo Breebaart | last post by:
I am writing a utility in Python and I'd like to add a command-line option "--mailto <address>" that will cause an e-mail summary to be sent to <address> when the utility finishes running. My...
5
12611
by: morphex | last post by:
Hi, I have an email that's in the utf-8 encoding, and I'm getting this error message when I try to send it using smtplib: * Module smtplib, line 688, in sendmail * Module smtplib, line 485,...
0
362
by: William Connery | last post by:
Hi, I have a small python program with e-mail capabilities that I have pieced together from code snippets found on the internet. The program uses the smtplib module to successfully send an...
2
1910
by: ornto | last post by:
Hi, I'm trying to create an application which checks a dynamic web site and on certain events sends an email to me. My problem though is with the email task. By now I made this simple test code: ...
4
1440
by: peter.jones.rpi | last post by:
I work at a training center and I would like to use Python to generate a number of certificates and then e-mail them. The certificates are a problem for another day - right now I just want to...
5
3097
by: sui | last post by:
this is my code import sys, os, glob, datetime, time import smtplib ## Parameters for SMTP session port=587 SMTPserver= 'smtp.gmail.com' SMTPuser= '...@gmail.com' pw= 'fill in here'...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.