Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 7th, 2006, 4:00 PM   #1
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,835
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
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?
Sane is offline   Reply With Quote
Old Jul 7th, 2006, 5:31 PM   #2
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by Sane
One consideration is that my ISP is blocking the forward to dr.sane@gmail.com.
This is likely. ISPs often block SMTP servers on their customer's machines in order to prevent spambots.

Why not send your email through your ISPs SMTP server?
Arevos is offline   Reply With Quote
Old Jul 7th, 2006, 6:22 PM   #3
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,835
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
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:
Originally Posted by IDLE
error: (10054, 'Connection reset by peer')
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()
Sane is offline   Reply With Quote
Old Jul 7th, 2006, 6:42 PM   #4
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
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.
Arevos is offline   Reply With Quote
Old Jul 7th, 2006, 7:13 PM   #5
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,835
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
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?
Sane is offline   Reply With Quote
Old Jul 8th, 2006, 6:33 AM   #6
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by Sane
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?
The only thing I can think of is to remove all words in your emails that might commonly be mostly found in spam. Other than that, there isn't any other way; any change you make to the email's headers can be replicated by a spammer.

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.
Arevos is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:16 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC