<%
DIM
ToEmlAddress,FromEmlAddress,MailTitle,MailContext
ToEmlAddress="收信者"
FromEmlAddress="寄信者"
'主旨
MailTitle="發信"
'內文
MailContext="內容"
Set Mail1 =
Server.CreateObject(" CDO.Message ")
'一定要加上這一段,否則如果你的Web Server上有安裝
Outlook 2002 等版本更新了CDOEX.DLL
'在ASP中會導致
senduse 的錯誤
Set iConf =
CreateObject("CDO.Configuration") Set Flds = iConf.Fields With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")
= 1.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
.Update
End With
Mail1.Configuration=iConf
'一定要指明 Encoding 為 7bits,否則送HTML格式的 email 時,因為編碼的原因,會導致 .jpg .不見Mail1.BodyPart.ContentTransferEncoding = "7bit"
'如果使用多國語言時,才要設定 Charset
'Mail1.BodyPart.Charset = "big5"
Mail1.To = ToEmlAddress
Mail1.From = FromEmlAddressMail1.Subject = MailTitle
Mail1.HTMLBody = MailContext '可使育TextBody
Mail1.Send
Set Mail1=Nothing
Set iConf = Nothing
參考
Setting the Subject and Message Text Body
http://msdn.microsoft.com/en-us/library/ms526246(v=exchg.10).aspx
沒有留言:
張貼留言