"Alberto Vera" <avera@coes.org .pe> wrote in message news:<mailman.1 064455474.2847. python-list@python.org >...[color=blue]
> Hello:
>
> Could you tell me How I can send an email using WIN2000? What do I need?[/color]
iConf = win32com.client .Dispatch("CDO. Configuration")
Flds = iConf.Fields
Flds("http://schemas.microso ft.com/cdo/configuration/smtpserver").Va lue = "someserver "
Flds("http://schemas.microso ft.com/cdo/configuration/smtpserverport" ).Value = 25
Flds("http://schemas.microso ft.com/cdo/configuration/sendusing").Val ue = 2 # cdoSendUsingPor t
# Authentication and stuff
Flds('http://schemas.microso ft.com/cdo/configuration/smtpauthenticat e').Value = 0 # No authentication
# The following fields are only used if the previous authentication value is set to 1 or 2
# Flds('http://schemas.microso ft.com/cdo/configuration/smtpaccountname ').Value = "user"
# Flds('http://schemas.microso ft.com/cdo/configuration/sendusername'). Value = "domain\\us er"
# Flds('http://schemas.microso ft.com/cdo/configuration/sendpassword'). Value = "password"
Flds.Update()
iMsg = win32com.client .Dispatch("CDO. Message")
iMsg.Configurat ion = iConf
iMsg.To = ";".join(emailA ddresses)
iMsg.From = "Test<test@test .com>"
iMsg.Subject = subject
iMsg.TextBody = body
# The following assumes the files to be in the current directory
for file in files:
iMsg.AddAttachm ent("file:///" + os.getcwd() + "/" + file)
iMsg.Send()
Felix.
[color=blue]
> Hello:
>
> Could you tell me How I can send an email using
> WIN2000? What do I need?
>
> Thanks[/color]
Alberto Vera wrote:[color=blue]
> Hello:
>
> Could you tell me How I can send an email using WIN2000? What do I need?
>
> Thanks[/color]
Why don't you try the following:
##### start of script #######
from email.MIMEText import MIMEText
import smtplib
myVar = 'result of previous action'
body='''this text will become the body of the message
Using triple-quotes you can span it easily over multiple lines.
You can also add the value of variables in it: %s .
This can come in handy if you want to mail
the result of an action''' % (myVar)
msg = MIMEText(body)
From = "myApp@myServer .net"
To = "whoever.is.int erested@mydomai n.org"
CC = "someone.else@m ydomain.org"
msg['From'] = From
msg['To'] = To
msg['Cc'] = CC
msg['Subject'] = "Don't leave me empty please"
server = smtplib.SMTP("m ailserver.mydom ain.org")
server.sendmail (From,[To,CC],msg.as_string( ))
server.quit
Comment