Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Godaddy Web Form to E-mail

Posted on 2011-03-08
10
Medium Priority
?
321 Views
Last Modified: 2012-05-11
I have a windows hosted account on godaddy.com with IIS7 running on integrated mode, but can't get the cdosys sendmail to work.  Any thoughts or suggestions?
<%@ Language=VBScript %>
<html>
<head>
</head>
<body>
<%
// language -- C#
// import namespace
using System.Web.Mail;

private void SendEmail()
{
   const string SERVER = "relay-hosting.secureserver.net";
   MailMessage oMail = new System.Web.Mail.MailMessage();
   oMail.From = "info@ms.com";
   oMail.To = "ms@hotmail.com";
   oMail.Subject = "Test email subject";
   oMail.BodyFormat = MailFormat.Html; // enumeration
   oMail.Priority = MailPriority.High; // enumeration
   oMail.Body = "Sent at: " + DateTime.Now;
   SmtpMail.SmtpServer = SERVER;
   SmtpMail.Send(oMail);
   oMail = null; // free up resources
}

%>
</body>
</html>

Open in new window

0
Comment
Question by:sargo22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 15

Expert Comment

by:pateljitu
ID: 35070793
Looks like you are using Classic ASP for email integration, use provided code for email.

set cdoMessage = Server.CreateObject("CDO.Message")

set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "relay-hosting.secureserver.net"
cdoConfig.Fields.Update

set cdoMessage.Configuration = cdoConfig
cdoMessage.From = "from@mydomain.com"
cdoMessage.To = to@mydomain.com
cdoMessage.Subject = "Feedback"
cdoMessage.Body = message
cdoMessage.Send
set cdoMessage = Nothing
set cdoConfig = Nothing

Open in new window

0
 

Author Comment

by:sargo22
ID: 35070943
I tried that and still no luck.  I should be able to go right to the asp page and it should send an e-mail correct?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 15

Expert Comment

by:pateljitu
ID: 35071355
Try this code.

Also do you receive any error while accessing ASP page.
<%@ Language=VBScript %>
<html>
<head>
</head>
<body>
<%

set cdoConfig = Server.CreateObject("CDO.Configuration")
	
With cdoConfig.Fields
		
	.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "relay-hosting.secureserver.net"
	.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 
	.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
	.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

	.Update
End With


Set CDOMessage = CreateObject("CDO.Message")
With CDOMessage
	Set .Configuration = cdoConfig

	.From = "info@ms.com"
	.To = "ms@hotmail.com"
	.Subject = "Test email subject"
	.HtmlBody = "Sent at: " + DateTime.Now
	.Send
End With

Set CDOMessage = Nothing
set cdoConfig = Nothing
%>
</body>
</html>

Open in new window

0
 

Author Comment

by:sargo22
ID: 35071554
I tried the new code and I still get an internal server error 500.  Would adding a redirect help?
0
 
LVL 15

Expert Comment

by:pateljitu
ID: 35072011
Lets try error trapping and see where code fails.
<%@ Language=VBScript %>
<html>
<head>
</head>
<body>
<%
on error resume next
set cdoConfig = Server.CreateObject("CDO.Configuration")
	
With cdoConfig.Fields
		
	.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "relay-hosting.secureserver.net"
	.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 
	.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
	.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

	.Update
End With

If (err.Number <> 0) Then 
	Response.Write(err.Description &" Error 1<br />")
	err.Number = 0
end if

Set CDOMessage = CreateObject("CDO.Message")
With CDOMessage
	Set .Configuration = cdoConfig

	.From = "info@ms.com"
	.To = "ms@hotmail.com"
	.Subject = "Test email subject"
	.HtmlBody = "Sent at: " + DateTime.Now
	.Send
End With

If (err.Number <> 0) Then 
	Response.Write(err.Description &" Error 2<br />")
	err.Number = 0
end if

Set CDOMessage = Nothing
set cdoConfig = Nothing
%>
</body>
</html>

Open in new window

0
 

Author Comment

by:sargo22
ID: 35072886
The transport failed to connect to the server. Error 2
0
 
LVL 15

Expert Comment

by:pateljitu
ID: 35073210
Code seems to be working fine in this case, looks like configuration issue with GoDaddy. If they provided with username and password for your SMTP setup, please add line as provided in code attached i.e. username and password.

Godaddy forum:
http://community.godaddy.com/groups/email/forum/topic/cdo-message-1-error-80040213/

Also:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/ASP/Q_23853223.html
With cdoConfig.Fields
		
	.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "relay-hosting.secureserver.net"
	.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 
	.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 
	.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
	.Item("http://schemas.microsoft.com/cdo/configuration/sendusername")="anymail@coolexample.com" //Replace this with provided username from Godaddy
	.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")="emailpassword" //Replace this with provided password from Godaddy

	.Update
End With

Open in new window

0
 

Author Comment

by:sargo22
ID: 35073618
Object required Error 2   - Not sure why I'm getting this error
0
 
LVL 15

Accepted Solution

by:
pateljitu earned 2000 total points
ID: 35074184
For error "Object required" replace this line of code
.HtmlBody = "Sent at: " + DateTime.Now
with
.HTMLBody = "Sent at: " & Now()
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question