I am trying to send mail through SMTP but i am getting the error unable to connect remote server, I have tried alot but still getting same error
I am hosted my site on Go Daddy,
please any body suggest me where i am wrong , or is there any settings on GoDaddy server to send mail from "relay-hosting.secureserver.net"
MailAddress fromAddress = new MailAddress(from);
message.From = fromAddress;
message.To.Add(toList);
System.Net.Mail.SmtpClient Client = new System.Net.Mail.SmtpClient("
relay-hosting.secureserver.net", 25);
Client.Credentials = CredentialCache.DefaultNetworkCredentials;
Client.DeliveryMethod = SmtpDeliveryMethod.Network;
Client.Send(message);
You are trying to send mail using remote SMTP server, but using credentials from your local environment.
Try to use another credentials class type to specify it more concrete:
Client.Credentials = new System.Net.NetworkCredential("yourusername", "yourpassword");
Referring to your code:
System.Net.Mail.SmtpClient Client = new System.Net.Mail.SmtpClient("
relay-hosting.secureserver.net", 25);
You're using port 25, which is actually the problem. System Administrators who utilize GoDaddy as their hosting provider may experience trouble sending mail over port 25. This is because GoDaddy requires their servers to send through their own SMTP Relay instead of any third party. This is really a frustration situation, but this is what Godaddy policy is. If you use Godaddy relay, then it will work.
Related
I want to send email in Azure Function. I write down below code. It works properly in console app & I am able to send email using the credentials. But when I tested the same code in Azure Function it throws me below error.
Exception while executing function: Functions.HttpTriggerCSharp. Microsoft.Azure.WebJobs.Script: One or more errors occurred. f-HttpTriggerCSharp__-1774598883: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [DB6P189CA0021.EURP189.PROD.OUTLOOK.COM]
The code I used -
SmtpClient client = new SmtpClient("smtp-mail.outlook.com");
string _sender = "--email--";
string _password = "-password---";
client.Port = 587;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
System.Net.NetworkCredential credentials =
new System.Net.NetworkCredential(_sender, _password);
client.EnableSsl = true;
client.Credentials = credentials;
string recipient = "--test#outlook.com--";
string subject="Temperature of device exceeds";
string message="Temperature of device exceeds";
try
{
var mail = new MailMessage(_sender.Trim(), recipient.Trim());
mail.Subject = subject;
mail.Body = message;
client.Send(mail);
}
catch (Exception ex)
{
}
I use a queuetrigger and follow your code in my azure function(v1) and it works well.
The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM
This message indicates that the SMTP server configured in your Outgoing Mail Account is connecting to an SMTP client submission endpoint which cannot be used for direct send.
Configure your Exchange SMTP to direct send.
Configure the email notification In the DS-Client > setup > configuration > notification Selected SMTP, add the SMTP server settings and selected add the SMTP server settings
Server require authentication.
Add the office365 authenticated account information in the SMTP server authentication window.
Refer to the following Microsoft articles for more information:
Fix issues with printers, scanners, and LOB applications that send email using Office 365
How to set up a multifunction device or application to send email using Office 365
im getting a 5.7.1 error when my app tries to send to an external recipient. the error doesnt say where the source comes from, is it the IIS server that cannot relay or is it my exchange server?
For testing I make it send one email internally and one externally. the internal one always comes through, but the external fails, im just tryign to find out where i need to be looking for errors, the exchange server or the IIS server (the IP used below is the exchange server)
Thanks
SmtpClient client = new SmtpClient();
var SMTPCredentials = new System.Net.NetworkCredential("User", "Pass", "Domain");
client.UseDefaultCredentials = false;
client.Credentials = SMTPCredentials;
client.Port = 25;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Host = "192.168.1.115";
Two things
Incorrect credentials where used
needed to use port 587 instead of 25
I am trying to send an e-mail from a simple console application using my company's mail server:
MailMessage mm = new MailMessage("myemail#mycompany.com", "myemail#mycompany.com", "test", "testbody");
SmtpClient client = new SmtpClient("mail.mycompany.com", 465);
client.Credentials = new NetworkCredential("myemail#mycompany.com", "myPassword");
client.EnableSsl = true;
client.Send(mm);
Console.WriteLine("email sent");
Console.ReadKey();
I am getting the following error: "Failure sending mail.", innerException is "Unable to read data from the transport connection: net_io_connectionclosed."
I have tried connecting to the mail server on that specific port via telnet, which was working fine. My login credentials were also tested on the webmail client and I was authenticated correctly. I have checked my firewall settings, and let Visual Studio through the firewall.
Any ideas what could cause the problem?
Regards,
Adam
Try setting the ssl to false and setting the port number to 25.
Also double check wether the smtp server is open, because then you won't need the login authentication parameters.
I am trying to write code to send a simple mail from asp.net page.
Confusion is over what to write under "smtp server", when I want to send mail using Microsoft Outlook 2007.
Two sets of code I'm trying:-
1.)
MailMessage objMail = new MailMessage();
objMail.From = "angenlina.jolie#compnayabc.com";
objMail.To = "brad.pitt#companyabc.com";
objMail.BodyFormat = MailFormat.Text;
objMail.Priority = MailPriority.High;
objMail.Subject = "Hi Sweetheart";
string smtpadd = "USA-LA-MAIL1.corp.hollwood.com";
SmtpMail.SmtpServer = "smtpadd";
SmtpMail.Send(objMail);
2.)
SmtpClient smtp = new SmtpClient();
smtp.Port = 25;
smtp.Host = "USA-LA-MAIL1.corp.hollwood.com";
smtp.Credentials = new NetworkCredential("username", "password");
MailMessage email_msg = new MailMessage();
email_msg.To.Add("brad.pitt#companyabc.com");
email_msg.From = new MailAddress("angenlina.jolie#companyabc.com");
email_msg.Subject = "test mail...";
email_msg.Body = "Hi SweetHeart";
email_msg.IsBodyHtml = false;
smtp.Send(email_msg);
Now my problem is what server name should I use for Microsoft outlook 2007(MS exchange server)?
Now my problem is what server name should I use for Micrsoft outlook 2007(MS exchange server)?
Are you sending email via MAPI (using their "Outlook profile") or via SMTP through an Exchange Server? They're not the same.
If you are sending through Exchange then the server will need to be configured to relay mail via SMTP. In which case, put the Exchange server in as the SMTP server.
If you're sending email via MAPI then you'll be using whatever mail server is configured in their "Outlook profile". Which could be SMTP, IMAP, Webmail (with a Hotmail connector or Gmail connector) or Exchange Server.
EDIT:
It sounds like you want to use the Exchange server via MAPI. Here is a good primer to the technologies involved.
Bear in mind that if you're configuring MAPI profiles from within the ASP .NET application you're going to pay attention to the service account the ASP .NET application runs as and that the MAPI is sometimes interactive and not suitable for service based applications.
You may be better off having an administrator configure the Exchange server to route email via SMTP (which is most likely is, unless you have a spam appliance in front of the server which handles SMTP).
try something generic i.e
Email Client setup information
IMAP server: imap.smtpserver.in
POP server: pop.smtpserver.in
SMTP server: smtp.smtpserver.in
Webmail
To access your email through a web browser visit http://webmail.smtpserver.in
smtpserver.in is your smtpserver host address.
I am trying to send an smtp email through gmail's smtp server using the code below:
MailMessage message = new MailMessage("myEmail#gmail.com", "myEmail#purdue.edu", "Testing SMTP", "Test, yo");
SmtpClient client = new SmtpClient();
client.EnableSsl = true;
client.Host = "smtp.gmail.com";
client.Port = 587;
client.Credentials = new NetworkCredential("myEmail#gmail.com", "myPassword");
client.Send(message);
Using the same code my friend successfully sent me an email from another network, but .NET throws the error "No connection could be made because the target machine actively refused it 74.125.91.109:587". This has to be a network issue right?
My network admin claims there are no blocked outbound ports and my firewall is entirely off, what else could be causing this? I have tried Purdue's smtp server as well (smtp.purdue.edu), and it fails with the same message.
Turn off any antivirus program.
Regarding the test to Purdue, are you sure that they use port 587?
You should use port 465 for SSL according to this
Change the port to 465. It worked for me.
This may caused by McAfee Virus Blocks the Mass Mailing Worms. you can do the following:
1.Open the VirusScan Console by right clicking the VirusScan shield in the system tray and select VirusScan Console...
2.Double click the Access Protection item and open it.
3.Uncheck the Prevent Mass Mailing Worms from Sending Mail rule.
4.Click OK and close the VirusScan Console.
Hope this is helpless.