Use cdonts to send mail ASP functions

zhaozj2021-02-16  73

<% "Last Updated by Recon On 05/14/2001" ON Error ResMe Next

"Send emails on Win2k using CDONTS components

"Send ordinary mail Sendmail" admin@ny.com "," Iamchn@263.net "," Normal Mail! "," Please Check the attatch ", 2, 0," c: /love.txt "

"Send HTML mail DIM M_FSO, M_TFDIM M_STRHTML

Set m_fso = server.createObject ("scripting.filesystemObject") set m_tf = m_fso.opentextfile ("c: /mail.htm", 1) m_strhtml = m_tf.readall

"WRITE M_STRHTMLSET M_TF = NothingSet M_FSO = Nothing

Sendmail "admin@ny.com", "Iamchn@263.net", "HTML Mail!", M_StrHTML, 2, 1, NULL

"Parameter Description" strFrom: sender Email "STRTO: Recipient Email" strsubject: Letter Theme "STRBODY: Letter Text" LNGIMPORTANCE: Letter Importance ": 0 - Low Importance": 0 - Medium Importance (Default) ": 0 - High Importance" LNGATYPE: Letter Format ": Take the message as HTML (at this time)" Strattach: Pathmail (Strfrom, Strto, STRSUBJECT, STRBODY, LNGIMPORTANCE, LNGATYPE) STRATTACH DIM OBJMAIL

Set objmail = Server.createObject ("cdonts.newmail") with objmail

.From = strfrom.to = stro.subject = strsubject.body = strabody.importance = lngimportance

If lcomatype = 1 dam.bodyFormat = 0.mailFormat = 0nd IF

IF ISEMPTY (Strattach) = false and isnull (strattach) = false then.attachfile stattachendiff

.SENDEND withSet Objmail = Nothingend Sub%>

转载请注明原文地址:https://www.9cbs.com/read-15194.html

New Post(0)