|
|
|
Ever wonder how to send email that looks like a web page? Here is how you do it. Note: You must have CDO for NT referenced for this to work. |
Click here to copy the following block |
Sub SendEmailHTML(From As String, SendTo As String, Subject As String, _ HTMLText As String, Optional AttachmentPath As String, _ Optional Attachment As String, Optional CC As String) Const constRoutine As String = "SendEmailHTML"
Dim strSendTo As String Dim objSendMail As CDONTS.NewMail Dim i As Integer
On Error GoTo ErrorHandler If SendTo = "" Then Exit Sub
Set objSendMail = New CDONTS.NewMail
With objSendMail On Error Resume Next .From = From If CC <> "" Then .CC = CC End If
On Error GoTo ErrorHandler .To = SendTo .Subject = Subject .Body = HTMLText .MailFormat = CdoMailFormats.CdoMailFormatMime .BodyFormat = CdoBodyFormats.CdoBodyFormatHTML AttachmentPath = Trim$(AttachmentPath) If AttachmentPath <> "" Then If Right$(AttachmentPath, 1) <> "\" Then AttachmentPath = AttachmentPath & "\" End If .AttachFile (AttachmentPath & Attachment) End If .Send End With ExitMe: Set objSendMail = Nothing Exit Sub
ErrorHandler: Err.Raise Err.Number, Err.Source, Err.Description
End Sub |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|