How do I send SMTP mail from a Azure website? - asp.net

I'm using the smtpclient class to send email from my asp.net website hosted on Azure in the 'shared' setup. Everywhere it says that port 25, and ALL ports are open on the Azure servers. My code works from my onw pc, but when published on Azure, it breaks. I am using gmail port 587 secure smpt and I get the error System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
Any ways to get around this? (Without installing a vm with Exchange on it, like ocme on, it's a simple email message).

You are getting that error because of these two possible reasons:
You are using the SMTPClient of Gmail and you are passing the EmailId of some other website like Yahoo/Hotmail etc.
EmailId you are using is not authenticated, you need to provide your mobile number to authenticate your Email Id.
If you are using Yahoo/Hotmail then you can refer to this article which I had created on http://www.c-sharpcorner.com/
http://www.c-sharpcorner.com/UploadFile/cd7c2e/send-bulk-email-from-yahoo-and-hotmail-using-Asp-Net/

Related

Unable to send email using smtp gmail account

I am working on small project using wordpress on my local host using Wamp.
I am trying to send email using smtp using my gmail account but its not working and showing me boolean false when i am trying to send test email.
I tried this with by changing my host and it's working fine with already working host which is mail.name.com.
but its not working with gmail i think there must be some setting in gmail to enable smtp to send mail. I searched online but i am unable to find solution.
step 1:
please login your gmail account and click blow link:
https://www.google.com/settings/security/lesssecureapps
and Access for less secure apps pick Turn On
Step 2:
Disable second steps vitrification off in your gmail account.
also asking with your hosting provider gmail smtp sever all allow or not In
godaddy you can not use gmail smtp server for sending mail.

SMTP email in Azure

I have an asp.net application where email is being sent via SMTP. If a user is listed in To as well as in Cc, the user is receiving the email twice. This happens only when the application is running in Azure. Doesn't happen when running on on-premise server. Any idea what needs to change in Azure world?
Yes that's how it should be and there is nothing wrong. It's not related to Azure at all. Ty testing the same in your office SMTP server and you will see same effect.
You should remove the recipient from cc list if it's not meant to be present.

How fix SMTP connection from an Azure Website?

Actually we have our website in WindowsAzure.
Its a Classic ASP site and its configured as a "Standard WebSite", 32Bit platform and its working with our domain.
As a traditional web, it uses a SMTP server to send email (ie. contacts from contact page).
We know Azure don´t provide SMTP server so we have tried with all these service with no luck:
RackSpace
Mandrill App
SendGrid (Recommended here).
For all of them, we are getting this error: "The transport failed to connect to the server."
How we can fix it?
Thanks,
We don´t know why but suddenly it begins to work.
The only change we did in the Azure config was putting ON the WebSockets but we think it was the solution.
We left the Mandrill smtp Server.

Send E-mail without using SMTP in Asp.net

My website uses ASP.NET to send emails, but my school's network administrator has blocked the SMTP port and services. After I visited the p2p forums I found a suggestion to use web service to send email, have you any suggestion which website would provide web service for sending emails?
I tried to use System.Web.Mail.MailMessage class to send the emails through my program, but it also fail. Anyone can help me to solve this problem? I need your help. Thank you!
You can use SendGrid.
They offer a webservice and you can send up to 200 emails a day with a free account.
They have code samples for several languages: https://github.com/sendgrid
I think Email sending with ASp.net has nothing to do with blocking of your smtp port and service of school.
You can use gmail's smtp server for sening email in your application/
SMTP URL HOST : smtp.gmail.com,
IS SSL Enabled : true,
PORT: 465,
USERId:your_username#gmail.com,
Password: Your_Password
Use Gmail, Yahoo or other Email providers to send a mail.
Please refer my answer #CodeProject - sending email to gmail from asp.net, if you want to use Gmail.
Also follow - Send Email from Yahoo, Gmail, Hotmail (C#).
Well that depends, if you are talking about the SMTP port of your network, then you can still use Gmail, Yahoo, Outlook or other ports, all you will be needing will be just a username and password alongwith the port (that must be 25) and the server address (for gmail it is smtp.gmail.com).
But if you are talking about Sending emails without using SMPT. Its not possible, with or without ASP.NET.
However, you can try using SmtpSettings for ASP.NET.
There are some other issue too. Please checked that the SmtpServer that you are using (gmail, yahoo etc) are allowed, because if they are blocked too, you would have to search for something new.
And yes, there are some other servers too. Like free email providers that would also let you use 200emails/day for free or something like that. You can check that out.
You mentioned you are using System.Web.Mail.MailMessage, here is an msdn blog post about setting the Smtp for that: http://msdn.microsoft.com/en-us/library/system.web.mail.mailmessage.aspx

sending mail in asp.net

i want to send a mail from a localhost to gmail in asp.net,i already set the ipaddress and the grant permission also,but now if i send the mail, failure sending mail error will occur. how can i solve this.pls anyone help me.
Thanks
Sending email requires SMTP Server. If you want to use Gmail SMTP Server to send emails from localhost, you need to configure gmail user email, password and SMTP Server. Here is an article that is helpful, disucssing many ways to send emails from ASP.NET.
Sending Email using C# and ASP.Net 2.0

Resources