could not send email in asp.net - c#

<div id="id04" class="modal">
<form class="modal-content" action="#">
<span onclick="document.getElementById('id04').style.display='none'" class="close" title="Close Modal">×</span>
<div class="modalcontainer">
<p style="font-family: 'Playfair Display', serif; font-size: 20px;">Reset Password</p>
<asp:TextBox ID="txt_resetEmail" CssClass="inputtxt" PlaceHolder="Email Address" runat="server" TextMode="Email"></asp:TextBox>
<asp:TextBox ID="txt_resetPassword" CssClass="inputtxt" PlaceHolder="New Password" runat="server" TextMode="password" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" ></asp:TextBox>
<asp:TextBox ID="txt_confirmNewPassword" CssClass="inputtxt" PlaceHolder="Confirm Password" runat="server" TextMode="password"></asp:TextBox>
<asp:CompareValidator
ID="CompareValidator2"
runat="server"
ErrorMessage="Passwords do not match."
ControlToValidate="txt_confirmNewPassword"
ControlToCompare="txt_resetPassword"
Operator="Equal" Type="String"
ForeColor="Red">
</asp:CompareValidator>
<asp:Button ID="Button1" class="btnsignin" runat="server" Text="Confirm" OnClick="btnSignIn_Confirm"/>
//when the user clicks on this button, email is being sent
</div>
<div class="register">
Don't have an account?
<a onclick="document.getElementById('id01').style.display='none';document.getElementById('id02').style.display='block';">Create an Account
</a>
<br />
<a style="color: #EC7063; font-size: 12px;"
onclick="document.getElementById('id01').style.display='none';document.getElementById('id03').style.display='block';">Sign in as Admin</a>
</div>
</form>
</div>
//backend code in the MasterPage.master.cs
protected void btnSignIn_Confirm(object sender, EventArgs e)
{
System.Diagnostics.Debug.WriteLine("come in");
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
mail.To.Add("to email");
mail.From = new MailAddress("from email", "head", System.Text.Encoding.UTF8);
mail.Subject = "This mail is send from asp.net application";
mail.SubjectEncoding = System.Text.Encoding.UTF8;
mail.Body = "This is Email Body Text";
mail.BodyEncoding = System.Text.Encoding.UTF8;
mail.IsBodyHtml = true;
mail.Priority = MailPriority.High;
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential("from email", "password");
client.Port = 587;
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
try
{
client.Send(mail);
System.Diagnostics.Debug.WriteLine("Can send email");
}
catch (Exception)
{
System.Diagnostics.Debug.WriteLine("soemthing wrong");
}
}
the system.Diagnostic.Writeline("") is also not writing anything on my output so I have no idea where my code is going
when I click on the button, my webpage just refreshes and nothing is being shown, I have created a real email for the "mail.from" in my code, and use my personal email as the "mail.ToAdd". But I did not receive anything

First try turn on less secure apps on for your google account to that fallow this link
if not work's
try providing Host value in Constructor of SmptClient
insted of doing
client.Host = "smtp.gmail.com";
do
SmtpClient client = new SmtpClient("smtp.gmail.com");

Related

How to obtain a parameter value from a URL to a web form in asp.net?

I have a problem on how to get the exact person id with email address to do resetting password. So, from here I will send a hyperlink to the user via email.
SmtpClient client = new SmtpClient();
try
{
SendPasswordResetEmail(u.EmailAddress.ToString(),u.Name.ToString(),UniqueID);
lblMessage.ForeColor = System.Drawing.Color.LimeGreen;
lblMessage.Text = "Email has been successfully sent!";
}
catch (Exception exc)
{
lblMessage.ForeColor = System.Drawing.Color.Red;
lblMessage.Text = "ERROR: " + exc.Message;
}
Then this is my message content to the user in order to let them click into the hyperlink.
string emailAddress = txtEmail.Text;
User u=db.Users.Single(x =>
x.EmailAddress == emailAddress);
MailMessage mailMessage = new MailMessage(u.EmailAddress, ToEmail);
StringBuilder sbEmailBody = new StringBuilder();
sbEmailBody.Append("Dear " + u.Name.ToString() + ",<br/><br/>");
sbEmailBody.Append("Please click on the following link to reset your password");
sbEmailBody.Append("<br/>"); sbEmailBody.Append("https://localhost:44305/Registration/ChangePwd.aspx?uid=" + u.Id);
sbEmailBody.Append("<br/><br/>");
sbEmailBody.Append("<b>吹水站</b>");
mailMessage.IsBodyHtml = true;
mailMessage.Body = sbEmailBody.ToString();
mailMessage.Subject = "Reset Your Password";
SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587);
MailMessage msg = new MailMessage();
msg.To.Add(new MailAddress(txtEmail.Text));
smtpClient.EnableSsl = true;
smtpClient.Send(mailMessage);
Then this is my ChangePwd.aspx?uid= pages
<form id="form1" runat="server">
<div>
<h1>Change password</h1>
</div>
<div>
<asp:Literal ID="litEmailAddress" runat="server"></asp:Literal>
</div>
<div>
<p>Enter new password :
<asp:TextBox ID="txtNewPwd" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Please fill in the blank" ControlToValidate="txtNewPwd" CssClass="error" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtNewPwd" CssClass="error" ErrorMessage="Password must be between 8-16 characters including at least 1 letter and 1 number" ValidationExpression="((?=.*\d)(?=.*[a-z]).{8,16})"></asp:RegularExpressionValidator>
</p>
</div>
<div>
Re-enter new password:
<asp:TextBox ID="txtRepeatPwd" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please fill in the blank" ControlToValidate="txtRepeatPwd" CssClass="error" Display="Dynamic"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtNewPwd" ControlToValidate="txtRepeatPwd" CssClass="error" ErrorMessage="Password and repeat password are not matched"></asp:CompareValidator>
</div>
<p>
<asp:Button ID="btnCancel" runat="server" Text="Cancel" CausesValidation="False" PostBackUrl="~/Registration/Login.aspx" /><asp:Button ID="btnConfirm" runat="server" Text="Confirm" OnClick="btnConfirm_Click" />
</p>
<div>
<p><asp:Label ID="lblSuccess" runat="server" Text=""></asp:Label></p>
<asp:Label ID="lblFailed" runat="server" Text=""></asp:Label>
</div>
</form>
From here, I don't know how to get the exact user email address when they clicked the hyperlink to ChangePwd.aspx to do resetting. And then, I have to update the database to store the updated changed password for the user. I tried to search online but lack of resources I got from the internet. Anyone please help thank you.
When the ChangePwd.aspx page is loaded you need to identify the user uniqely so that you can save the new password to that specific user. What you need here is to pass the primary id(either user Id or email address) from your email to the ChangePwd.aspx page. Which you are doing correctly by passing the ID to the Urls query string,
https://localhost:44305/Registration/ChangePwd.aspx?uid=" + u.Id);
Now, You need to read this in your ChangePwd.aspx.cs (the serverside class of the WebForm). You can do something like this in the page_load method,
protected void Page_Load(object sender, EventArgs e)
{
string userId= Request.QueryString["uid"];
// get the user *User* from the database, using the above retrieved ID
litEmailAddress.text = User.email; // something like this
}
Now, you can save the new password to this user. Let me know if this helps or need more help.
You should be able to use the Request.QueryString property to access the value of uid specified in the URL (i.e. Request.QueryString["uid"]). It should then be straightforward to fetch the User object with that Id and get the user's email address.
Here is a basic tutorial: https://www.c-sharpcorner.com/UploadFile/ca2535/query-string-in-Asp-Net/

Display image inside email message sent from website using c# asp.net

Is this possible to display one image inside email message which is sent from user's website ? and this image is present and run in localhost.
If yes ,then how ?I have tried once but unable to display the image.I am sending the below html template to my email from my app.
<!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>
<title>Reset your password</title>
</head>
<body>
<img src="http://localhost:3440/img/blue/logo.png" alt="Odiya doctor" /><br />
<br />
<div style="border-top: 3px solid #22BCE5">
</div>
<span style="font-family: Arial; font-size: 10pt">Hello <b>User</b>,<br />
<br />
For reset your password please click on below link<br />
<br />
<a style="color: #22BCE5" href="{Url}">Click me to reset your password</a><br />
<br />
<br />
Thanks<br />
For contacting us.<br />
<a href="http://localhost:3440/localhost:3440/index.aspx" style="color: Green;">Odiya
doctor</a> </span>
</body>
</html>
index.aspx.cs:
protected void userPass_Click(object sender, EventArgs e)
{
string body= this.GetBody("http://localhost:3440/resetPassword.aspx");
this.sendEmailToUser(respassemail.Text.Trim(), body);
}
private string GetBody(string url)
{
string body = string.Empty;
using (StreamReader reader= new StreamReader(Server.MapPath("~/emailBodyPart.htm")))
{
body = reader.ReadToEnd();
}
body = body.Replace("{Url}", url);
return body;
}
private void sendEmailToUser(string recepientEmail, string body)
{
using (MailMessage mailMessage = new MailMessage())
{
try
{
mailMessage.From = new MailAddress(ConfigurationManager.AppSettings["UserName"]);
mailMessage.Subject = "Password Reset";
mailMessage.Body = body;
mailMessage.IsBodyHtml = true;
mailMessage.To.Add(new MailAddress(recepientEmail));
SmtpClient smtp = new SmtpClient();
smtp.Host = ConfigurationManager.AppSettings["Host"];
smtp.EnableSsl = Convert.ToBoolean(ConfigurationManager.AppSettings["EnableSsl"]);
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = ConfigurationManager.AppSettings["UserName"];
NetworkCred.Password = ConfigurationManager.AppSettings["Password"];
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = int.Parse(ConfigurationManager.AppSettings["Port"]);
smtp.Send(mailMessage);
resetText.InnerText = "";
resetText.InnerText = "Check your email to reset your password.In case you did not find in inbox of your email please chcek the spam.";
resetText.Style.Add("color", "green");
}
catch (Exception e)
{
resetText.InnerText = "";
resetText.InnerText = "Email sending failed due to :"+e.Message;
resetText.Style.Add("color", "red");
}
}
}
When the above html template has sent to email,Inside email message i am unable to display image.Please help me.
If the image is hosted via localhost, the only time it will work is if the email is opened on the local host of the individual user's machine. Local host is not able to be resolved on a different machine. (Computer, Phone, Tablet, etc.)
If you wanted to make it work elsewhere, the server would have to be exposed with a URL/IP that could be resolved.

User Control code behind is not called when published on server

I have a simple user control which is basically a contact form and consists of three text boxes, 1 button and 1 label. I am also using Telerik RadAjaxLoadingPanel and RadAjaxPanel. The markup of the user control is given below,
<telerik:RadAjaxLoadingPanel ID="RALP_ContactForm" runat="server" Transparency="5">
<div class="border" style="display: table; height: 240px; width: 240px; #position: relative;
overflow: hidden; background-color:White">
<div class="border" style="#position: absolute; #top: 50%; display: table-cell; text-align: center;
vertical-align: middle;">
<div class="border" style="width: 100%; #position: relative; #top: -50%">
<img src="images/cf_animation.GIF" alt="Processing Request..." />
</div>
</div>
</div>
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxPanel ID="upContactForm" runat="server">
<div id="form-main">
<div id="form-div">
<p class="name">
<asp:TextBox ID="txtContactName" ValidationGroup="ContactForm" CausesValidation="true"
runat="server" name="name" CssClass="validate[required,custom[onlyLetter],length[0,100]] feedback-input"
ClientIDMode="Static" placeholder="Name"></asp:TextBox>
<asp:CustomValidator ID="customValidator" runat="server" ValidationGroup="ContactForm"
ControlToValidate="txtContactName" Display="Dynamic" ClientValidationFunction="ValidateContactName"
ErrorMessage="" ValidateEmptyText="true"></asp:CustomValidator>
</p>
<p class="email">
<asp:TextBox ID="txtContactEmail" ValidationGroup="ContactForm" CausesValidation="true"
runat="server" name="email" CssClass="validate[required,custom[onlyLetter],length[0,100]] feedback-input"
ClientIDMode="Static" placeholder="Email"></asp:TextBox>
<asp:CustomValidator ID="customValidator1" runat="server" ValidationGroup="ContactForm"
ControlToValidate="txtContactEmail" Display="Dynamic" ClientValidationFunction="ValidateContactEmail"
ErrorMessage="" ValidateEmptyText="true"></asp:CustomValidator>
</p>
<p class="text">
<asp:TextBox ID="txtContactComment" ValidationGroup="ContactForm" CausesValidation="true"
TextMode="MultiLine" runat="server" name="text" ClientIDMode="Static" CssClass="validate[required,custom[onlyLetter],length[0,100]] feedback-input"
placeholder="Comment"></asp:TextBox>
<asp:CustomValidator ID="customValidator2" runat="server" ValidationGroup="ContactForm"
ControlToValidate="txtContactComment" Display="Dynamic" ClientValidationFunction="ValidateContactComment"
ErrorMessage="" ValidateEmptyText="true"></asp:CustomValidator>
</p>
<p><asp:Label ID="lblMessage" runat="server" Visible="false"></asp:Label></p>
<div class="submit">
<asp:Button ID="btnSubmitContactForm" Width="100%" runat="server" ValidationGroup="ContactForm"
Text="SEND" CssClass="btn-flat gr btn-submit-reg" OnClick="btnSubmitContactForm_Click" />
</div>
</div>
</div>
On the code behind I am just sending the information from the textboxes to an email address. The code for the event when the submit button is clicked is as follow,
protected void btnSubmitContactForm_Click(object sender, EventArgs e)
{
try
{
string AppPath = Request.PhysicalApplicationPath;
StreamReader sr = new StreamReader(AppPath + "EmailTemplates/UserFeedback.htm");
string MailBody = sr.ReadToEnd();
MailBody = MailBody.Replace("<%Name%>", txtContactName.Text.Trim());
MailBody = MailBody.Replace("<%Email%>", txtContactEmail.Text.Trim());
MailBody = MailBody.Replace("<%Comments%>", txtContactComment.Text.Trim());
// Close the StreamReader after reading text from it
sr.Close();
MailMessage message = new MailMessage(
"sender#mymail.com",
"receiver#mymail.com",
"Feedback",
MailBody);
message.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "mail.myserver.com";
smtp.Port = 25;
smtp.EnableSsl = false;
smtp.Credentials = new NetworkCredential("MyUserName", "MyPassword");
try
{
smtp.Send(message);
}
catch
{
}
txtContactComment.Text = "";
txtContactEmail.Text = "";
txtContactName.Text = "";
lblMessage.Visible = true;
lblMessage.ForeColor = System.Drawing.Color.Green;
lblMessage.Text = "Feedback sent successfully!";
}
catch
{
lblMessage.Visible = true;
lblMessage.ForeColor = System.Drawing.Color.Red;
lblMessage.Text = "Error sending feedback ! ";
}
}
The User control is called like this,
<uc1:FooterContactForm ID="FooterContactForm" runat="server"></uc1:FooterContactForm>
And at the top of the page,
<%# Register Src="ContactForm.ascx" TagName="FooterContactForm" TagPrefix="uc1" %>
Now all this is very simple and works just fine on my test machine. When I publish this in the server then loading image is displayed but code behind is not fired. I have tried to set the dummy text in the label on Page_Load event of the user control but even that test is not displayed on the user control on live server. I am receiving email every time when I submit this locally.
My question is that why the code behind is not called when the user control is published on the live server and is someone else has experienced such issue?
Edit: (Errors found from console)
POST http://test.mywebsite.com/ 500 (Internal Server Error)
Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScri…:6
Sys.Net.XMLHttpExecutor.executeRequest
Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScri…:6
Sys.Net._WebRequestManager.executeRequest
Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScri…:6
Sys.Net.WebRequest.invoke
Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScri…:15
Sys.WebForms.PageRequestManager._onFormSubmit
Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScri…:15
Sys.WebForms.PageRequestManager._doPostBackTelerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScri…:15
Sys.WebForms.PageRequestManager._doPostBackWithOptions
Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScri…:6
(anonymous function)(index):800
onclick
Second error:
Uncaught Sys.WebForms.PageRequestManagerServerErrorException:
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScri…:6 Error.create
Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScri…:15
Sys.WebForms.PageRequestManager._createPageRequestManagerServerError
Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScri…:15
Sys.WebForms.PageRequestManager._onFormSubmitCompleted
Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScri…:6 (anonymous function)
Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScri…:6 (anonymous function)
Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScri…:6
Sys.Net.WebRequest.completed
Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScri…:6 _onReadyStateChange
When you have something inside an ajax panel, and for some reason starts to not work, then is probably a javascript error that you miss, a file that is not loaded, an exception that you did not see.
In this cases just remove the ajax panel to locate the error on the code, and/or check the javascript console error on the browser.
From your comments sounds that if the user is not authenticated, some javascript files on some folder fail to load because of the security and then you have some javascript errors that not let your code run correctly.

How to make a "Confirm Subscribe" button for gmail?

How can I make a button "Confirm Subscription" like in MailChimp?
My HTML code so far:
<div itemscope itemtype="http://schema.org/EmailMessage">
<meta itemprop="description" content="Confirmacao de inscricao" />
<div itemprop="action" itemscope itemtype="http://schema.org/ConfirmAction">
<meta itemprop="name" content="Confirmar Agora" />
<div itemprop="handler"
itemscope itemtype="http://schema.org/HttpActionHandler">
<link itemprop="url"
href="http://beta.pegacupom.com.br/confirmnews.aspx?code=xyz" />
</div>
</div>
</div>
The above code was tested in 'https://developers.google.com/gmail/schemas/testing-your-schema' and works correctly.
But when I put that code in my c# website, the email does not send.
Can be some problem with SPF or DKIM ?
This is my code to send mail in C#:
System.Net.Mail.MailMessage objMail = new System.Net.Mail.MailMessage();
objMail.From = new MailAddress("myemail#myDOMAIN.com", "myName");
objMail.To.Add(new MailAddress(emailTO));
objMail.Headers.Add("Content-Type", "text/html");
objMail.Body = mensagem;
objMail.IsBodyHtml = true;
objMail.SubjectEncoding = Encoding.GetEncoding("ISO-8859-1");
objMail.BodyEncoding = Encoding.GetEncoding("ISO-8859-1");
objMail.Subject = assunto;
SmtpClient objSMTP = new SmtpClient("smtp.myDOMAIN.com.br", 587);
System.Net.NetworkCredential objCredential = new System.Net.NetworkCredential("name#myDOMAIN.com.br", "myPASS");
objSMTP.Credentials = objCredential;
objSMTP.Send(objMail);
Why does the email not send?
Try to enable SSL:
objSMTP.Credentials = objCredential;
objSMTP.EnableSsl = true; // add this line
objSMTP.Send(objMail);
Hope this helps.

ASP.NET Contact form issues

I'm setting this form up for a small business, so all the email gets sent directly to their mail server. I input the correct information and the mail successfully sends from the website, but it will never reach their mail server. Their mail server does give errors on the contact form saying 5.7.1 Message rejected as spam by Content Filtering. If it doesn't detect spam it will send, but still the server wont receive it.
Am I doing something wrong with the code or is the mail server rejecting it?
c#
using System;
using System.Net.Mail;
public partial class _Emailer : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
try
{
string output = "";
MailMessage mail = new MailMessage();
// Replace with your own host address
string hostAddress = "xxx.xxx.xxx.xxx";
// Replaces newlines with br
string message = Request.Form["c_Message"].ToString();
message = message.Replace(Environment.NewLine, "<br />");
output = "<p>Name: " + Request.Form["c_Name"].ToString() + ".</p>";
output += "<p>E-mail: " + Request.Form["c_Email"].ToString() + ".</p>";
output += "<p>Phone: " + Request.Form["c_Phone"].ToString() + ".</p>";
output += "<p>Message: " + message + ".</p>";
mail.From = new MailAddress("xxxxxxx#xxxxxx.org");
mail.To.Add("xxxxxxx#xxxxxxx.org");
mail.Subject = "New e-mail.";
mail.Body = output;
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient(hostAddress);
smtp.EnableSsl = false;
smtp.Send(mail);
lblOutcome.Text = "E-mail sent successfully.";
}
catch (Exception err)
{
lblOutcome.Text = "There was an exception whilst sending the e-mail: " + err.ToString() + ".";
}
}
}
}
HTML
<asp:label id="lblOutcome" runat="server" />
<form name="contact" method="post" id="cf">
<div id="contactform">
<p><img src="images/required_star.png" alt="Star" /> Required fields for contact form completion</p>
<ol>
<li>
<label for="c_Name" class="required-star">Name:</label>
<input type="text" id="Text1" name="c_Name" placeholder="John Doe" class="required text" minlength="2" value="<% Response.Write(Request.Form["c_Name"]); %>" />
</li>
<li>
<label for="c_Email" class="required-star">Email:</label>
<input type="text" id="Text2" name="c_Email" class="required email text" placeholder="example#domain.com" value="<% Response.Write(Request.Form["c_Email"]); %>" />
</li>
<li>
<label for="c_Phone">Phone:</label>
<input type="text" id="Text3" name="c_Phone" class="phoneUS text" placeholder="ex. (555) 555-5555" value="<% Response.Write(Request.Form["c_Company"]); %>" />
</li>
<li>
<label for="c_Message" class="required-star">Message:</label>
<textarea id="Textarea1" name="c_Message" rows="6" cols="50" class="required" placeholder="..." minlength="2"><% Response.Write(Request.Form["c_Message"]); %></textarea>
</li>
<li class="buttons">
<input title="Submit" class="buttonBlue" value="Submit" type="submit" />
<input title="Clear the form" class="buttonBlue" value="Clear" type="reset" />
</li>
</ol>
</div>
</form>
It looks like this is all down to the mail server filtering the emails. Perhaps contact the email host and explain your problem.
It may be treated as spam because of a lot of reasons. One of them is that from address does not match the host email was sent from. E.g. you are sending email from pop3.yourhost.com and from field is my#name.com
Anyway it seems to have nothing to do with ASP.NET

Categories

Resources