How to find out which SMTP server is being used?

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(); //lblConfirmation.Text = strBody.ToString(); SmtpMail.Send(msgMail); panForm.Visible = false; panConfirm.Visible = true; lblSubject.Text = ddQueryType.SelectedValue; lblFrom.Text = txtEmail.Text; lblBody.Text = txtQuery.Text; lblFirstName.Text = txtFirstName.Text; lblLastName.Text = txtLastName.Text; lblDate.Text = DateTime.Now.ToLongDateString(); lblTime.Text = DateTime.Now.ToShortTimeString(); } myReader.Close(); } catch { lblConfirmation.Text = "Sorry I broke part way through, please call us instead on the number above."; } myConnection.Close(); } } 

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

+4
source share
3 answers

It is very likely that the SMTP server data is stored in the web.config file. See if you can find the <system.net> in the web.config file.

 <system.net> <mailSettings> <smtp from=" user@domain.com "> <network host="SMTP.SITE.COM" port="25" userName=" name@domain.com " password="yourPassword"/> </smtp> </mailSettings> </system.net> 
+3
source

You can use a network sniffer such as Wireshark (for free) to track SMTP traffic, but make sure you have administrator permission to use such a tool before downloading / installing / using: such tools have naughty applications, as well as benign ones.

0
source

Make sure DNS is not a problem. Should the mail host that should receive the test email no longer accept mail if the reverse DNS lookup for the sending domain does not display your site, or maybe there is no PTR record?

By the way, last week I had the same problem. Emails that were sent successfully suddenly stopped working because the server was apparently grayed out for these reasons.

If your application uses a local SMTP server, you will see SMTP errors in the Windows event files.

0
source

Source: https://habr.com/ru/post/1299888/


All Articles