Total .NET newbie here. I've done a decent amount of old ASP in the past, so forgive my ignorance.
I have a site being hosted on GoDaddy. They have informed me that I need to use CDOSYS instead of CDONTS to process a from into an email. However, none of the codes I've found on the web work, so I thought I would actually try giving the code the GoDaddy support team sent me.
Not knowing C#, I have taken the code, wrapped it in <% %>, dropped it on a page, and saved it with an aspx extension, but I get the following syntax error for line 2:
Line 1: <%
Line 2: // language -- C#
Line 3: // import namespace using System.Web.Mail;
Two questions:
1. How do I fix the code (included below) so it works?
2. How do I add code to pick up fields from my form (like phone number) to include in the email?
Thanks!
Code:
<%
// 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@buxmonttorch.com";
oMail.To = "ian_gendreau@hermanmiller.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
}
%>