0

I am sending a mail using CDO.Message. When the user submits a form, the form details to be sent to the Web Site Owner and a Acknowledgement mail to the user. The later is not working for me. I have repeated the same code twice by changing the configuration names, I simply get "Internal Server Error"

My Code (mail to the Web Site Owner)

<%
name = Request.Form ("name")
email = Request.Form ("email")
phone = Request.Form ("phone")
message = Request.Form ("message")

Dim iMsg, iConf, Flds, vSub

Response.CodePage = 65001
Response.CharSet = "utf-8"

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

'sending email with Google Apps Premium SMTP server (with autentication)
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "smtpserver") = "localhost"
Flds.Item(schema & "smtpserverport") = 25
Flds.Item(schema & "sendusername") = "info@priceakagri.ru"
Flds.Item(schema & "sendpassword") = "******"
Flds.Update

With iMsg
Set .Configuration = iConf
.BodyPart.Charset = "utf-8"
.To = "info@akagri.ru"
.From = "info@priceakagri.ru"
.Subject="Message from Priceakagri.ru contact page"

.HTMLBody="Здравствуйте! <br><br>You have received an Enquiry from <font color='#337AB7'><b>" & Trim(Request("name")) & "</b></font>.<br><br><br><table><tr><td width='30%' colspan='2' bgcolor='#337AB7'>Message Details</td></tr><tr><td>Name</td><td>" & Trim(Request("name")) & "</td></tr><tr><td>Email</td><td>" & Trim(Request("email")) & "</td></tr><tr><td>Phone</td><td>" & Trim(Request("phone")) & "</td></tr><tr><td>Message</td><td>" & Trim(Request("message")) & "</td></tr></table>"
Set .Configuration = iConf
.Send
End With
set iMsg = nothing
set iConf = nothing
set Flds = nothing
%>

The above code works perfectly for me. If I replicate the same and send user a mail on acknowledgement, I get error. I used the users email as .To and From as - info@priceakagri.ru

I have done this in my earlier sites, where I include a .txt file for the later and still is working for me.

Need help.

Regards, Badri

Badri
  • 1
  • Probably the first thing you need to do is to enable detailed error messages, so that you see something more useful than "internal server error" - see this page. http://www.chestysoft.com/asp-error-messages.asp – John Apr 30 '16 at 11:36
  • Hi John, This error I get when I upload in my server not localhost. – Badri Apr 30 '16 at 15:49
  • Do you not have RDP access to your server? If you don't you can use the web.config file - as detailed in the second answer to this question. http://stackoverflow.com/questions/2640526/detailed-500-error-message-asp-iis-7-5 – John Apr 30 '16 at 15:54

0 Answers0