Loading

Using CDOSYS to Send Email especially for Godaddy

Submitted by: 


Here is the code to send Email from your website.I had tested this code on My Godaddy Web hosting and it was perfectly working.
The things need to be change is in Red colour

// language -- C#
// import namespace
using System.Web.Mail;

private void SendEmail()
{
// Don't change this if you are using godaddy otherwise mention your smtp server name.

const string SERVER = "relay-hosting.secureserver.net";
MailMessage oMail = new System.Web.Mail.MailMessage();
oMail.From = "emailaddress@domainname";
oMail.To = "emailaddress@domainname";
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
}

Note : plaese include the System.Web.Mail namespace in the header section of your asp.net page

About the author:

PlanetSourceCode.in is a place for all developer providing free source codes, articles, MCA complete projects,complete application in PHP, C/C++, Javascript, Visual Basic, Cobol, Pascal, ASP/VBScript, AJAX, SQL, Perl, Python, Ruby, Mobile Development




Comments

Thanks man!! Your solution works. I was trying from last 4 hours for this. But after using your method, problem is solved. Keep doing good work !!!!

Hi

Good code!!!!!!!!!!, i have written same code and working for one website but when i developed another web site the same code not working, it is giving me error i.e. security error . i have hosted two web sites on different domains in godady.

its not working.

i write that code, its in vb.net

------------
Dim SERVER As String = "relay-hosting.secureserver.net"
Dim oMail As New System.Web.Mail.MailMessage
oMail.From = "info@referencetown.com"
oMail.To = emailTo
oMail.Subject = "Test email subject"
oMail.BodyFormat = MailFormat.Html
oMail.Priority = Mail.MailPriority.High
oMail.Body = "Sent at: " + DateTime.Now
SmtpMail.SmtpServer = SERVER
SmtpMail.Send(oMail)
Response.Write("donnnnn")
oMail = Nothing
------------------------------------
if any thing wrong please tell me....
thank you

Pages

Add new comment

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.