troubleshooting Question

How to send utf-8 email using Classic ASP

Avatar of Lev Seltzer
Lev SeltzerFlag for Israel asked on
ASPMicrosoft IIS Web Server
3 Comments1 Solution4809 ViewsLast Modified:
I am having difficulty sending a message using Classic ASP and a mail component. I have created a test program (below) which uses one of several available email components. The result of all of them is the unicode text is displayed as ????.

The program below is currently on the server http://www.wow-imports.com/WBMailTest.asp. It only sends email to me for the test.

What am I doing wrong? How do I get at least ONE of these components to send out my test (so that I can then go back to my real program and get that to work)?

Thank you.
<html>
 
<head>
<%@Language=VBScript Codepage=65001%>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta content="en-us" http-equiv="Content-Language">
<title>Mail Test</title>
</head>
 
<body>
 
<% 
 
strFromName="Lev Seltzer"
strFromEmail="lev@seltzer.co.il"
strToName="Test Recipient"
strToEmail="lev.seltzer@gmail.com"
strLetter="HI<br>éÜÕÝ"
strContactFormSubject="WEBuilder Test"
strMailServer="LocalHost"
strMailComponent="JMAIL"
 
 
select case strMailComponent
case "SMTPsvg"
	Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
	Mailer.FromName   = strFromName
	Mailer.FromAddress= strFromEmail
	Mailer.AddRecipient strToName,strToEmail
	if len(strReplyToName)>0 then
		Mailer.ReplyTo = strReplyToEmail
	end if
	Mailer.RemoteHost = strMailServer
	Mailer.Subject    =  strContactFormSubject
	Mailer.ContentType = "text/html"
	Mailer.BodyText = strLetter
	response.write "Mail Component used: SMTPsvg.Mailer version " & Mailer.version & "<br/>"
	if Mailer.SendMail then
		SendLetters = "Mail sent."
	else
		SendLetters = "Mail send failure. Error was " & Mailer.Response
	end if
case "CDONTS"
	Set mailer = CreateObject("CDONTS.NewMail")
    Mailer.From= strFromEmail
    Mailer.To=strToEmail
	if len(strReplyToName)>0 then
		Mailer.Value("Reply-To")  = strReplyToEmail
	end if
    Mailer.Subject=strContactFormSubject
	Mailer.BodyFormat=0
    Mailer.MailFormat=0
	Mailer.Body = strLetter
	response.write "Mail Component used: CDONTS<br/>"
    Mailer.Send
    SendLetters = "No confirmation with CDONTS"
case "CDOMESSAGE"
	Set mailer = CreateObject("CDO.message")
    Mailer.From= """" & strFromName & """<" & strFromEmail & ">"""
	if len(strReplyToName)>0 then
		Mailer.ReplyTo = """" & strReplyToName & """<" & strReplyToEmail & ">"""
	end if
    Mailer.To=strToEmail
    Mailer.Subject=strContactFormSubject
	Mailer.HTMLBody = strLetter
	response.write "Mail Component used: CDO.Message<br/>"
    Mailer.Send
    SendLetters = "No confirmation with CDO.MESSAGE"
case "PERSISTS.MailSender"
	Set Mailer = Server.CreateObject("Persits.MailSender")
	Mailer.Host       = strMailServer
	Mailer.FromName   = strFromName
	Mailer.From       = strFromEmail
	Mailer.AddAddress strToEmail,strToName
	if len(strReplyToName)>0 then
		Mailer.AddReplyTo strReplyToEmail,strReplyToName
	end if
	Mailer.Subject    =  strContactFormSubject
	Mailer.isHTML = True
	Mailer.Body = strLetter
	response.write "Mail Component used: Persits.MailSender version " & Mailer.version & "<br/>"
case "ASPSMARTMAIL"
	Set Mailer = Server.CreateObject("AspSmartMail.SmartMail")
	Mailer.SenderName   = strFromName
	Mailer.SenderAddress= strFromEmail
	Mailer.Recipients.Add strToEmail, strToName
	Mailer.server = strMailServer
	Mailer.Subject    =  strContactFormSubject
	Mailer.ContentType = "text/html"
	Mailer.Body = strLetter
	response.write "Mail Component used: AspSmartMail.SmartMail<br/>"
	SendLetters = "Mail Sent."
	On Error Resume Next
    Mailer.Send
    If Err <> 0 Then
    	SendLetters = "Error message: " & Err.Description
    end if
case "JMAIL"
	Set Mailer = Server.CreateObject("JMAil.Message")
	Mailer.FromName   = strFromName
	Mailer.From= strFromEmail
	Mailer.Subject    =  strContactFormSubject
	mailer.AddRecipient strToEmail, strToName
	Mailer.HTMLbody = strLetter
	Mailer.Charset      = "UTF-8"
	Mailer.MailServerPassWord=gv_MailServerPassWord
	Mailer.MailServerUserName=gv_MailServerUserName
	response.write "Mail Component used: JMAIL<br/>"
	Mailer.Send(strMailServer)
end select
 
response.write X & " Letter to " & strToName & " - " & strToEmail  & "; from: " & strFromName & " (" & strFromEmail & "); Results: " & SendLetters & "<br/>"
 
%>
 
</body>
 
</html>
ASKER CERTIFIED SOLUTION
Member_2_3718378

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros