ASP
Here you can find some FREE usefull Classic ASP / VBScript code snippets, class modules, etc.
Function SendCDOMail(String, String, String, String,
Boolean, Boolean)Boolean Very direct function
to send Email using CDO.Message object.
Example
Please note that your server must support CDO.Message object. You must also hard-code your SMTP Server, Port and Charset (optional). Usage SendCDOMail (From, To, Subject, Body, Bcc, HTML) From - The sender's email address To - The recipient's email address Subject - The message subject Body - The message body Bcc - If set to True the email message will be sent as Bcc (Blind Carbon Copy) HTML - If set to True the message body will be sent as HTML. If False, it will be sent as plain text. <% Dim bossSub, bossMsg, guysSub, guysMsg bossSub = "Not going to work today" bossMsg = "Hi. I've got the flue... See you tomorrow!" guysSub = "Beach time!!!" guysMsg = "Managed to skip work! On to the beach guys!" if SendCDOMail("me@home.xyz", "boss@work.xyz", bossSub, bossMsg, False, True) then SendCDOMail "me@home.xyz", "guys@beach.xyz", guysSub, guysMsg, False, True end if %> Source Code <%
Function SendCDOMail(mFrom, mTo, mSubj, mBody, mBCC, mHTMLFormat) Dim Message ' set your configuration here Const my_smtp_server = "smtp.yourserver.com" Const my_smtp_port = 25 Const my_charset = "windows-1252" ' optional On Error Resume Next Set Message = CreateObject("CDO.Message") Message.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 Message.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = my_smtp_server Message.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = my_smtp_port Message.Configuration.Fields.Update Message.BodyPart.ContentMediaType = "text/html;" If my_charset > "" Then Message.BodyPart.Charset = my_charset Message.From = mFrom If mBCC Then Message.Bcc = mTo Else Message.To = mTo Message.Subject = mSubj If mHTMLFormat Then Message.HtmlBody = mBody Else Message.TextBody = mBody Message.Send Set Message = Nothing SendCDOMail = (Err.Number = 0) On Error GoTo 0 End Function %> |