Question : Problem sending mails from contact us form

Hi,

I used to host my site on Win2k3 32bit with mail components such as cdosys and cdonts.
Recently I migrated my domain to Win2k3 64bit with mailenable and cdosys, and then I started to encounter problems with my contact us form.
The error I'm getting is:
--------------------------------------------------
CDO.Message.1 error '80040220'

The "SendUsing" configuration value is invalid.

/contact_us_submit.asp, line 99
---------------------------------------------------

Since my web designer no longer works with me, it left me to do all the work and I'm almost completely noob in this area.
Attached here is the code related to line 99.
Please help me to solve this issue.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
Function SendMail( fromWho, toWho, Subject, Body )
 
	   Set Mailer = CreateObject("CDO.Message")
		Mailer.Bodypart.ContentMediaType = "text/html"
		Mailer.Bodypart.ContentTransferEncoding = "7bit"
		Mailer.Bodypart.Charset= "windows-1255"
		Mailer.From       = fromWho 'request("sendfrom")
		Mailer.To         = toWho 'request("sendto")
		'Mailer.BCC        = "[email protected]"
		Mailer.Subject    = Subject '" "
		Mailer.HTMLBody   = Body
		Mailer.Send

Answer : Problem sending mails from contact us form

Check this out, this guy had the same problem and the code at the end of the thread fixed it:  http://forums.aspfree.com/asp-development-5/cdo-message-1-error-80040220t-47913.html

I've applied it to your code, try it out. You'll need to change the <enter_mail.server_here> to the IP/Name of your email server, if you're running a local instance you can probably just set that to 127.0.0.1.

I think that first part (the METADATA thing) needs to be at the to of your asp page. I don't do asp, so I'm not sure about that.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
<!--
METADATA
TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library"
--> 
 
Function SendMail( fromWho, toWho, Subject, Body )
	Set cdoConfig = CreateObject("CDO.Configuration")
 
	With cdoConfig.Fields
	.Item(cdoSendUsingMethod) = cdoSendUsingPort
	.Item(cdoSMTPServer) = "<enter_mail.server_here>"
	.Update
	End With
 
	Set Mailer = CreateObject("CDO.Message")
	With Mailer
	Set .Configuration = cdoConfig
	.Bodypart.ContentMediaType = "text/html"
	.Bodypart.ContentTransferEncoding = "7bit"
	.Bodypart.Charset= "windows-1255"
	.From       = fromWho 'request("sendfrom")
	.To         = toWho 'request("sendto")
	.Subject    = Subject '" "
	.HTMLBody   = Body
	.Send
	End With
	
	Set cdoConfig = Nothing
	Set Mailer = Nothing
End Function
Random Solutions  
 
programming4us programming4us