Reputation: 47
My goal is to generate emails inside of my Asp/VB.net program. After following instructions very carefully using https://web.archive.org/web/20211020121616/https://www.4guysfromrolla.com/articles/072606-1.aspx some stackoverflow users helped me modify my class object on the asp.net page. We also revised my host/port settings in the web.config file. I still throw an exception when I try to send email which says 'Unable to connect to remote server.' After talking to the godaddy.com tech support they said I need to use the incomming server pop.secureserver.net and the outgoing server smtpout.secureserver.net. He had no further clarification. My question is, how do I set up the incomming and outgoing servers?
Upvotes: 0
Views: 1018
Reputation: 11
You don't even need to change anything in the web config. Just name the following code something .aspx and change the email addresses, dump it in your root directory, go to the webpage via your browser and you should recieve a mail.
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Mail" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<%
// Send Mail
MailMessage lMail = new MailMessage();
lMail.To = "[email protected]";
lMail.From = "[email protected]";
lMail.Subject = "Subject";
lMail.Body = "Body";
SmtpMail.SmtpServer = "relay-hosting.secureserver.net";
SmtpMail.Send(lMail);
lMail = null;
Response.Write("Mail sent");
%>
</body>
</html>
Upvotes: 1
Reputation: 1979
As you probably know, this is the config:
<system.net>
<mailSettings>
<smtp deliveryMethod="network" from="[email protected]">
<network host="smtpserver" port="25"></network>
</smtp>
</mailSettings>
</system.net>
You need to change smtpserver to smtpout.secureserver.net If that doesn't work, make sure with godaddy support that there's no "SMTP authentication" required on that server. If it's required, you can include user name/password in the node like so:
<network host="smtpserver" port="25" userName="username" password="password"></network>
UPDATE: according to http://help.godaddy.com/article/4219 the smtpserver should be
relay-hosting.secureserver.net
same is described here asp.net Setting up email as poster below mentioned
Upvotes: 1
Reputation: 2356
if you are only sending email, then i cant see why you would need anything relating to pop as that is how you would retrieve mail. Have you tried manually connecting to the smtp server from a console?
Just try and telnet to your host and send port 25 as the port and see what happens, eg
telnet smtpout.secureserver.net 25
From there you should be able to tell if you can at least get a connection, if you can try sending some mail through it. Just Google SMTP commands for how to do it
Upvotes: 0