Classic ASP : Email Charset Problem


#1

Hi,

Well I am a PHP Programmer, and I am coding in Classic ASP for some reason. I am stuck at a place. My script need to send an email that will have Swedish Characters. I have below code, the Subject is fine however the email body shows ?? in place of all the Swedish characters. Like this: Best??llning Ovriga ??nskem??l

Please help me !
Regards
Z

<%@Language = VBScript Codepage = 65001 %>
<%
dim objMail 
Set objMail = Server.CreateObject("CDO.Message") 

dim smtpServer, yourEmail, yourPassword
smtpServer = "127.0.0.1"
yourEmail = "no_reply@mydomain.com"     
yourPassword = "my_password"
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = true
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = yourEmail
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = yourPassword
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

objMail.BodyPart.Charset = "utf-8"
objMail.Configuration.Fields.Update 
objMail.Subject="Beställning Ovriga önskemål"
objMail.htmlBody = "<strong>Beställning Ovriga önskemål</strong>"
objMail.htmlBodyPart.Charset = "utf-8"
objMail.from = yourEmail
objMail.to = "recipient@some_mail.com"
objMail.Send  
%>

#2

Someone plz help. If there is a better forum than SitePoint plz tell mobso that I ask my question there.


#3

Where I am it's the weekend and weekends tend to be quieter here. I haven't touched ASP for quite a while, but are you sure "htmlBodyPart" shouldn't be "BodyPart"?

https://msdn.microsoft.com/en-us/library/ms526224(v=exchg.10).aspx


#4

Thanks for your reply. Well I tried all the combinations. Not sure what is wrong. Subject Line is fine, the email body is not ok.


#5

I haven't learned ASP, but sounds like you're stressing.

Have you tried w3schools, stackoverflow, or just tried searching online for answers?

I would refrain from Yahoo and Quora for answers. Yahoo is filled with the most !@#$% up answers, and unless you are VERY popular, the so-called "experts" on Quora won't answer.

Stack sites you need to be careful about asking questions, but I have found many solutions on SO just by looking for my issue. Another is like @Mittineague posted, look at MSN for solutions.

Sorry I can't help you with your code, but hopefully it might lead you in your quest for finding forums, as you were desperately seeking.


#6

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.