February 28th, 2006, 10:42 PM
Help with email sending and retreiving
how can i send and recieve emails through python. I know you use the smtplib module but what host should i plug into this if i use hotmail?:
>>> import smtplib
February 28th, 2006, 11:15 PM
March 1st, 2006, 12:58 AM
soo basically noone knows????
March 1st, 2006, 07:09 AM
Did you read the link? And some of the comments following it?
"Free email services like Hotmail don't have mail servers that you can plug into just any email client. They are typically web-only services.
Why? Because they're free. They make money by presenting advertising, or links to other sites, along with your email. If they allowed access to any other email clients, that advertising would disappear."
They don't have them. You can't do it without stepping up to one of the extra hotmail services that costs money.
Comments on this post
March 1st, 2006, 02:27 PM
I know how to send email; receiving it depends on you having a valid account on the system though. The code is in my article here:
Originally Posted by miryln
Google is your friend,
March 3rd, 2006, 10:45 PM
##That code is too complicated I have finally figured out ##what to do here is the code:
def mail(address, subject, message, host = 'localhost'):
msg = """\
SUBJECT: THiS is kinda cool
soo anyways u change all this to ur personal preferences and u use the smtplib to sendmail to recipiants.
s = smtplib.SMTP('mail')
s.sendmail('firstname.lastname@example.org', 'email@example.com', msg)
March 3rd, 2006, 10:47 PM
with all this comes one problem, if u want to send email from other domain names you end up sending your ip address too. because of hotmails sender id The message will either be denied or sent to junk mail. ANYONE KNOW HOW TO CHANGE SENDER ID???
March 3rd, 2006, 11:12 PM
No clue, it didn't used to end up in Junk mail when I wrote the function .
Originally Posted by miryln
It could be being sent as a header but it seems more likely hotmail is just records the IP of any connections made to it, in which case you could try masking your IP or something similar?
Also, what you mean by too complicated is that you don't get it right?
It's really very simply, and explained fully on the page. The function was designed to take a number of email addresses because it makes more sense to do it that way than to send the same email to people individually.
All you've done to make it more simple is to remove that and to put the header string into a less precise form – you have no control over what line endings that are being used and that can cause some big problems from my experience .
You don't have to have it so it can send to multiple email addresses (I linked to it so you could see how it worked) but you should leave the header construction as is because "\r\n" is required. So your script may fail on systems that use just an "\n".
You should also read the how to ask a question thread at the top of the forum to find out how to use code tags .
March 4th, 2006, 02:12 AM
yes that is what im saying. Im new to python and that is too complicated for me to understand. Could you tell me te function to mask your i.p. address. thankyou for the article is there anyway you could explain it better or should i just read it more?
March 5th, 2006, 06:36 AM
And what about retreiving NEW messages from POP3 server? How to do this? I can't see any function in poplib which checks for "seen" flag of a message.
March 5th, 2006, 06:48 PM
You will need to track that yourself, AFAIK.
Originally Posted by kornerr
Probably easiest done with the UIDL command - it returns a unique identifier for each message on the server.
Track the unique identifiers, and only retrieve messages you haven't seen before.
March 5th, 2006, 06:59 PM
If you make a TCP/IP connection to a remote computer, it will always get your IP address (so it can send stuff back to you, such "packet received" acknowledgements).
There is no way to usefully mask your IP address and have a full connection to another machine.
The only option is to go through a proxy - but the proxy will get your IP address - and if you have an SMTP proxy and send email through it, it will put your IP address in the email itself as the source of the email.
The only sender ID that I know of that relates to what you are asking is SPF (Sender Policy Framework)
When you try to send mail, the server at the other end goes through the process:
a) This remote IP Address is trying to send email from firstname.lastname@example.org
b) I'll just check devshed.com and look for SPF records to see which computers are allowed to send email from @devshed.com addresses.
c) I will allow this email/mark this email as spam based on the results of the check.
If you are trying to send from email@example.com, then any sensible receiving server will check, and find that your IP isn't allowed to send email claiming to be from a hotmail account.
And, there's nothing you can do about it short of registering your own domain.
Comments on this post
Last edited by sfb; March 5th, 2006 at 07:01 PM.
March 6th, 2006, 01:41 AM
soo I am starting to understand this, but is there anyway to succesfully change your ip address or at least send the message from another ip?