On 16/01/07, gandalf gold <[EMAIL PROTECTED]> wrote:
>
> Hi everyone,
>
> I was trying out smtplib and found out that I can email to anyone in my
> domain but not to an email address not in the domain. From browsing on the
> web, it seems that this has to do with the configuration of the mail server.
> The mail server in my organization is MS exchange. Obviously I can email to
> any email address from my MS outlook.
>
> What's the easiest way to fix the program?
>
> Thanks.
>
> - gan
>
> import sys, smtplib
> fr = "[EMAIL PROTECTED]"
> to = "[EMAIL PROTECTED]" # will not work
> line = "testing"
> subj = "subject line"
> msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s" % (fr, to, subj, line)
> server = smtplib.SMTP("EXCHCLUSTER.ccis.edu")
> server.set_debuglevel(1)
> server.sendmail(fr, [to], msg)
> server.quit()
>

You will need to get smtplib to authenticate when connecting to the
exchange server.    Use the login function and the same username/pw
that you use to login to Outlook.

server.login(user, password)

Note: Your exchange administrator may have disabled this function.  (
Your Outlook will almost certainly be using MAPI not SMTP to talk to
the server).

HTH :)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to