Accredited Registrar
How to authenticate the mail in ASP.NET?
First, create a file named test.aspx and insert the below mentioned code.
<% @Page Language=C# CodeFile=test.aspx.cs Inherits=test %>
Then create another file in the name of test.aspx.cs and then add the below placed code in the 'test.aspx.cs' file.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
public partial class test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
MailMessage message = new MailMessage(
SmtpClient emailClient = new SmtpClient(
System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential(
emailClient.UseDefaultCredentials = false;emailClient.Credentials = SMTPUserInfo;emailClient.Send(message);litStatus.Text = Message Sent;
}
catch (Exception ex)
{
litStatus.Text=ex.ToString();
}
}
}
Note that in above mentioned code
replace user name with your email address for e.g. test@sitename.com,
replace password with your password,
replace sitename with your website/domain name,
Note that normally the smtp client server name is smtp.domain name, but for HIOX the smtp client server name is sitename.
|
Not at all
helpful Not much
helpful Some what
helpful Very
helpful Extremely
helpful | ||||||||
What could be better? (Optional)
X
Not related to my issue
Too complicated explanations
Too much information
Incorrect information
Unclear information
Incomplete information
Too old information
Do you have any other feedback about this faq ? 1000
| ||||||||