April 26, 2002 at 11:32 pm
hi friends,
i am sending a mail thru CDonts via Stored Procedure. The mail is scheduled by job. The mail is sent using sp_OAMethod. The mail is going but i want it in good html format but i am not able to include html format. How can i do it. the code is as follows:
to VARCHAR(8000),
@subject VARCHAR(8000),
@body VARCHAR(8000)
AS
DECLARE @result INT
DECLARE @object INT
PRINT 'Creating the CDONTS.NewMail object'
EXEC @result = sp_OACreate 'CDONTS.NewMail', @object OUTPUT
IF @result <> 0
BEGIN
PRINT 'sp_OACreate Failed'
RETURN @result
END
PRINT 'Sending the message using the Send method'
EXEC @result = sp_OAMethod @object, 'Send', NULL, @from, @to, @subject, @body
IF @result <> 0
BEGIN
PRINT 'sp_OAMethod Failed'
RETURN @result
END
PRINT 'Destroying the CDONTS.NewMail object'
EXEC @result = sp_OADestroy @object
IF @result <> 0
BEGIN
PRINT 'sp_OADestroy Failed'
RETURN @result
END
RETURN 0
-------------------------
Please suggest the needed.
Regards,
sunayana
sunayana
April 27, 2002 at 1:58 pm
Pulled this from msdn:
Example
This code fragment shows the usage of the BodyFormat property in preparing and sending an HTML message:
Dim myMail
Set myMail = CreateObject("CDONTS.NewMail")
HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & vbCrLf
HTML = HTML & "<html>"
HTML = HTML & "<head>"
HTML = HTML & "<meta http-equiv=""Content-Type"""
HTML = HTML & ""content=""text/html; charset=iso-8859-1"">""
HTML = HTML & "<title>Sample NewMail</title>"
HTML = HTML & "</head>"
HTML = HTML & "<body>"
HTML = HTML & "This is a sample message being sent using HTML. <BR></body>"
HTML = HTML & "</html>"
myMail.From = "Example@microsoft.com"
myMail.To = "Someone@microsoft.com"
myMail.Subject = "Sample Message"
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = HTML
myMail.Send
Set myMail = Nothing
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy