On 22/08/06, Tim Roberts <[EMAIL PROTECTED]> wrote: > John Draper <[EMAIL PROTECTED]> wrote:
Hi Tim :) > Tim William's answer is not exactly correct. The host you specify in the > smtplib.SMTP constructor should NOT be the MX record for any of the > recipients. You should never have to look up MX records yourself. actually, I said: this will be a server from the recipient's domain's mx records (or your ISP server). :) However it really depends on the use-case, relaying through another server will give you no control over bad addresses, you have to wait for bounces from the recipient's server, or conversely the ISP server can give fails 4xx & 5xx for valid addresses. The ISP may only accept email addressed from their local domains, and you may be breaking their TOCs or AUP and get blocked. On the flip side, some ISPs block outbound port 25 except through their servers, or transparent proxy port 25, so Direct MX is unusable. Blacklists are hit and miss, even large ISPs can get listed. If you are on a "clean" range then it shouldn't matter, you can look up your IP on various blacklists to see if it is affected. Also Many fixed IP addresses don't have valid PTRs so they can fail as often as dynamic IP addresses which usually do have valid PTRs John Draper <[EMAIL PROTECTED]> wrote: > Hmmm - the problem I have is if I knowingly > put in a bad recipient, and try to send to a > unknown user, I get all appearances that > the mail went through. Yes this will happen if you use a relay server. > Ok, so If I already have a MX hostname > of "mail.myhost.com", then I would put > into my "to_email"... <myusername>@myhost.com for Yes, if you just used username the server wouldn't know which domain the email was being sent to and therefore how to route it. > By the way, I'm sending this mail to a "sms" > gateway to a cellular provider, so the > username is their phone number. If you only ever send to this gateway then you might as well try MX records, you will have more control, but you will need to manage queueing yourself for temporary failures, or you may decide that if you get a temporary failure (4xx) to just fire the email off to your ISP server and let them deal with it. > But > (sigh), these providers don't appear > to tell me if I put in a bogus phone number. Unfortunately not all mail servers will fail an invalid address even if they aren't relaying the email. But in this case the SMS "gateway" is probably relaying to a backend system for the SMSc and will accept any address with a valid domain part. HTH :) -- http://mail.python.org/mailman/listinfo/python-list