I recently took responsibility for taking care of a customer website that was built by asp.net by a former employee. (who hastened to work for these clients!)
The company is going to switch to the php platform in the near future, but until then they have problems with email delivery. NOTE. I do not own asp.net
Now, none of the codes on any of these customer sites has been changed recently. We host them on your reseller hosting account at Namesco in the UK.
I believe the problem is that the SMTP server does not allow these emails. However, I canβt find where the SMTP address is set in the code?
Some background information on this client setup:
They have two sites - the main site, whose domain ends in .co.uk Then a separate site, whose domain ends in .tv
The .co.uk and .tv code for web forms is exactly the same. .Co.uk emails go through, but .tv emails have suddenly stopped.
When a potential customer fills out a web form and submits requests. The script calls the database, which adds additional text to the email address and adds it to the FROM address:
eg. noreply@customersite.tv noreply@customersite.co.uk
If the FROM: address has changed from .tv to .co.uk, then email messages sent from web forms of .tv sites will be sent successfully. So, for me, the problem is that the SMTP server no longer likes the .tv FROM address?
Thus, the client still receives their emails, however this will ruin the filtering of the mailboxes that they set up. Therefore, they want to work as before.
Here is the code in the aspx.cs file for the contact page:
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.Sql; using System.Data.SqlClient; using System.Data.SqlTypes; using System.Configuration; using System.Web.Mail; using System.Text; public partial class contactus : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { this.Master.FindControl("divMasterContactForm").Visible = false; this.Master.FindControl("contactFormHeader").Visible = false; } protected void butSubmit_Click(object sender, ImageClickEventArgs e) { string strConnection, strCommand, strPage; strPage = Request.Url.ToString(); strConnection = ConfigurationManager.ConnectionStrings["dbString"].ConnectionString; strCommand = "SELECT * FROM [mailOptions] WHERE [url] LIKE 'customerswebsite.tv'"; StringBuilder strBody = new StringBuilder(); SqlConnection myConnection = new SqlConnection(strConnection); SqlCommand myCommand = new SqlCommand(strCommand); myCommand.Connection = myConnection; myConnection.Open(); try { SqlDataReader myReader = myCommand.ExecuteReader(); while (myReader.Read()) { strBody.Append("<html><body><font face='Arial'><br>"); strBody.Append(txtQuery.Text); strBody.Append("<br><br>Regards,<br><br>"); strBody.Append(txtFirstName.Text + " " + txtLastName.Text); strBody.Append("<br><br>Telephone number: " + txtPhone.Text); strBody.Append("<br><br>Mobile Number: " + txtMobile.Text); strBody.Append("<br><br>Email Address: <a href=mailto:" + txtEmail.Text + ">" + txtEmail.Text + "</a></font></body></html>"); MailMessage msgMail = new MailMessage(); msgMail.To = myReader["to"].ToString(); msgMail.Bcc = " info@ourwebdesignfirm.com "; msgMail.From = myReader["from"].ToString(); msgMail.Subject = ddQueryType.SelectedValue + " From: " + txtFirstName.Text + " " + txtLastName.Text + ". Generated from " + myReader["leadSource"].ToString(); msgMail.BodyFormat = MailFormat.Html; msgMail.Body = strBody.ToString();
Currently my problem is that I cannot check or track the path of these messages, because I canβt find which SMTP server uses these messages? Any help appreciated