oleobject jmail
Jmail = Create OLEObject
Jmail.ConnectToNewObject("JMail.Message")
Jmail.Charset = 'GB2312' //中文用 “GB2312”
Jmail.ISOEncodeHeaders = True
Jmail.silent = True
Jmail.Logging = True
Jmail.From = an_jmail.fro_email //发件人邮箱
Jmail.FromName = an_jmail.fro_person //发件人
Jmail.Subject = an_jmail.title //邮件主题
Jmail.MailServerUserName = an_jmail.fro_email //发件邮箱登录账户
Jmail.MailServerPassword = an_jmail.fro_pass //发件邮箱用户密码
Jmail.Priority = 3 //表示邮件发送的优先级,1为最快,5为最慢,3为默认值
Jmail.AddRecipient(an_jmail.to_email) //收件人邮箱
Jmail.htmlBody = an_jmail.body + "~r~n" //邮件内容
long i
//messagebox('', upperbound(an_jmail.filename))
for i = 1 to upperbound(an_jmail.filename) step 1
//messagebox('',an_jmail.filename[i])
jmail.AddAttachment ( an_jmail.filename[i])
next
string ls_send_sever
string ls_msg
string ls_data_msg
ls_send_sever = 'smtp.' + mid(an_jmail.fro_email,pos(an_jmail.fro_email,'@') + 1 )
ls_data_msg = '发件人邮箱:'+an_jmail.fro_email + '~r~n' +&
+'发件人姓名:'+an_jmail.fro_person + '~r~n' +&
+'主题:'+an_jmail.title + '~r~n' +&
+'发件人邮箱密码:'+an_jmail.fro_pass + '~r~n' +&
+'收件人邮箱:'+an_jmail.to_email
if profilestring('/ini/set.init','SYSTEM','DEBUG','') = '1' then
messagebox('', ls_data_msg)
end if
IF Jmail.Send(ls_send_sever) THEN //ls_host为发件邮箱服务器
as_msg = "发送成功!"
//messagebox('',as_msg)
Jmail.Close()
Destroy Jmail
return 0
ELSE
as_msg = "发送失败!"
//messagebox('',as_msg)
Jmail.Close()
Destroy Jmail
return -1
END IF