Asked by:
Failure Sending Maill In Asp.net Core

Question
-
User338455301 posted
HI,
I use this code to send email in last and worked correctly but now when i send mail it show this error :
Errorno such is known
EmailService
using (var client = new SmtpClient()) { var credential = new NetworkCredential { UserName = _configuration["EmailSender:Username"], Password = _configuration["EmailSender:Password"] }; client.Credentials = credential; client.Host = _configuration["EmailSender:Host"]; client.Port = int.Parse(_configuration["EmailSender:Port"]); client.EnableSsl = false; try { using (var emailMessage = new MailMessage()) { emailMessage.To.Add(new MailAddress(email)); emailMessage.From = new MailAddress(_configuration["EmailSender:Email"]); emailMessage.Subject = subject; emailMessage.Body = message; emailMessage.IsBodyHtml = true; client.Send(emailMessage); } } catch (Exception er) { throw; }
AppSetting
"EmailSender": { "Email": "info@abroon.net", "Host": "smtp.abroon.net", "Port": 587, "EnableSSL": false, "UserName": "***********", "Password": "***********" },
what's problem ?
Sunday, September 29, 2019 11:21 AM
All replies
-
User475983607 posted
We need the actual error not a paraphrased error. Usually port 587 is secured by SSL. Contact your SMTP host for the proper configuration. Also, I tried to ping smtp.abroon.net and the host does not exist. Are you sure the host is correct?
Sunday, September 29, 2019 11:40 AM -
User338455301 posted
i have this :
and change host name in asppsetting to : Host: abroon.net
but in send mail its how this error
InnerException = {"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 5.63.13.222:587"}Monday, September 30, 2019 9:34 AM -
User475983607 posted
Your follow up post is not helpful.
Let's try this again... What is the actual error?
Post 587 is usually secured with TLS. Are you sure you do not need TLS?
I tried to ping and the host was not found. Are you sure the host is correct?
Microsoft Windows [Version 10.0.18362.356] (c) 2019 Microsoft Corporation. All rights reserved. C:\WINDOWS\system32>ping smtp.abroon.net Ping request could not find host smtp.abroon.net. Please check the name and try again. C:\WINDOWS\system32>
telnet also failed.
C:\WINDOWS\system32>telnet smtp.abroon.net 587 Connecting To smtp.abroon.net...Could not open connection to the host, on port 587: Connect failed C:\WINDOWS\system32>
Contact your host service for assistance. This question has little to do with ASP.NET Core.
Monday, September 30, 2019 11:16 AM -
User753101303 posted
Hi,
Usually it means the request is sent successfully but the response is blocked (proxy, firewall etc...). AFAIK you should also enable SSL.
You are trying to access your own SMTP server from an hosting service?
Monday, September 30, 2019 11:22 AM -
User338455301 posted
yes i trying to access your own SMTP server from an hosting service in local host,
what's problem ?Saturday, October 5, 2019 11:36 AM -
User475983607 posted
what's problem ?Your are asking questions in the wrong support forum. Contact your SMTP host for assistance as it seems your SMTP service is not available on the Internet.
Saturday, October 5, 2019 12:13 PM -
User-474980206 posted
It’s unlikely that you domain is the smtp domain. You need to get the smtp settings for your mail provider. As a web mail provider they may not have smtp support.
Saturday, October 5, 2019 5:28 PM