I got it to work, but I had to change and rearrange the script quite dramatically to get it to work.Make sure you update the code to reflect you email address and the IP address of your mail server.
import arcgisscripting, smtplib, os, sys, traceback
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders
gp = arcgisscripting.create(9.3)
#**********************************************************************
# Description:
# Emails a file. File is assumed to be a zip file. Routine either attaches
# the zip file to the email or sends the URL to the zip file.
#
# Parameters:
# 1 - File to send.
# 2 - Email address to send file.
# 3 - Name of outgoing email server.
# 4 - Output boolean success flag.
#**********************************************************************
def send_mail(send_from, sendto, subject, text, f, server, sendZip = False):
# Construct the message
#
msg = MIMEMultipart()
msg['vince@xxx.com'] = send_from
msg['grill@with.com'] = COMMASPACE.join(sendto)
msg['Date'] = formatdate(localtime=True)
msg['Subject'] = subject
msg.attach( MIMEText(text) )
part = MIMEBase('application', "dbf") # Change if different file type sent.
part.set_payload( open(f,"rb").read() )
Encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename="%s"' % os.path.basename(f))
msg.attach(part)
smtp = smtplib.SMTP(server)
smtp.sendmail(send_from, sendto, msg.as_string())
smtp.close()
## Arguments
# Path to dbf
dbffile = sys.argv[1]
# Email
sendto = sys.argv[2]
# IP address
eMailServer = sys.argv[3]
subject = "DBF file attached"
text = "Attached is the dbf file you requested."
sendZip = True
send_mail("200.110.100.1", sendto, subject, text, dbffile, eMailServer, sendZip)
print "Sent dbffile to "+sendto+" from 200.110.100.1"