![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programming Guru
![]() |
Sending An E-Mail With SMTP
I download QK SMTP Server, and have it running on my webserver. I forwarded port 25 to it, and then run this code:
import smtplib host = 'jammersbase.com' fromaddr = 'admin@jammersbase.com' toaddrs = 'dr.sane@gmail.com' subject = 'hello world!' content = 'this is my test e-mail' message = 'From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s'%(fromaddr, toaddrs, subject, content) server = smtplib.SMTP(host) server.sendmail(fromaddr, toaddrs, message) server.quit() My mail server recieves the e-mail, then tries to send it to dr.sane@gmail.com, but times out. I must be doing some blatantly incorrect. I have little experience with this, so it's probably being approached in the completely incorrect manner. One consideration is that my ISP is blocking the forward to dr.sane@gmail.com. Consider pointing me in the right direction? |
|
|
|
|
|
#2 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quote:
Why not send your email through your ISPs SMTP server? |
|
|
|
|
|
|
#3 | |
|
Programming Guru
![]() |
How do I find out my ISPs SMTP server? Would it be my <insert username here>@sympatico.ca address? In which case the server would be sympatico.ca ... ?
So you don't see anything incorrect with my logic? I wasn't sure if the server specified was supposed to be the destination, the source, or just some random server... EDIT - This code did not work. Quote:
import smtplib host = 'sympatico.ca' fromaddr = 'admin@jammersbase.com' toaddrs = 'dr.sane@gmail.com' subject = 'hello world!' content = 'this is my test e-mail' message = 'From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s'%(fromaddr, toaddrs, subject, content) server = smtplib.SMTP(host) server.sendmail(fromaddr, toaddrs, message) server.quit() |
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quite often the SMTP server is something like "mail.yourisp.com" or "smtp.yourisp.com". They'll have the address on their site somewhere, as any internet uses who wishes to send an email from a desktop email client (such as Outlook or Thunderbird) will need it.
|
|
|
|
|
|
#5 |
|
Programming Guru
![]() |
Yes! Thank-you! A quick google revealed it was 'smtp1.sympatico.ca'. It works too. Thank-you for your help.
To anyone, would you know of any strategies for protecting your e-mails from appearing as spam? I know using a valid source address is one thing. Any helpful advice to moderating the actual content or method of sending? |
|
|
|
|
|
#6 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quote:
I suppose you have a header that all your recipients are expecting, and that is unlikely to be found on spam. For instance, mailing lists often add their name to the subjects of emails sent to them. The recipients, therefore, can be reasonably certain that any email with "[my-mailing-list]" in the subject, are not spam. Of course, this assumes the recipients have some measure of control over their spam filtering systems. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|