Gmail SMTP clien fails on Azure - c#

When I send mail from local it works pretty well, but when I deploy on azure it fails.
Error: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. Learn more at

This generally happens when you try login from different time zone or IP Address Computer. Your production server and the mail id you have used both are in different time zone. Choose either of these two solutions:
Log in to production server via remote access, and sign in to gmail once with your credentials. They will ask for the confirmation, confirm it and log out. (If you are using a VM)
OR
log in gmail to your local computer, Follow this Link and choose review this activity and take proper actions.
Check out this SO question to know more (additionally you can verify Roshan Parmar's points from this): https://stackoverflow.com/questions/20906077/gmail-error-the-smtp-server-requires-a-secure-connection-or-the-client-was-not#:~:text=solution%20for%20case%201%3A%20Enter,to%20login%20from%20all%20apps.&text=Use%20that%20newly%20generated%20password%20to%20authenticate%20via%20SMTP.

Related

How to send mail(gmail mail) programmatically without using SMTP server

I am trying to send mail(using Gmail) using SMTP but somehow server is blocking to send emails.(Our application is hosted on GoDaddy server).
And it is showing below error,
An attempt was made to access a socket in a way forbidden by its access permissions 185.107.232.247:587
Make the change to your Godaddy account. "Check the SSL Full-time box"
Activate your gmail account. Check the SSL box. My settings are
smtpout.secureserver.net Port 465
name and password of your godaddy account
SSL box checked.
Once gmail is working, GO BACK and uncheck the Godaddy account SSL box referenced in 1, the gmail account still works.

Exchange Web Services (EWS) client doesn't work on server, but works locally

We have a simple service that uses EWS 2.0 to connect to an Outlook mailbox and process email in a shared mailbox (yup, I know :))... so...
We created a domain user and gave it full rights to the mailbox. I'm specifying the WebCredentials, and for accessing the shared mailbox, I new up a Folder object with the mailbox name and using StreamingNotifications to watch the inbox.
All works fine on my PC.
We tried installing it on a server and we get a 401 access denied. If I go to that machine and telnet to the EWS server on 443, it lets me in, so its not a firewall issue. Like I said, I can run the app on my PC, so the mailbox and exchange are configured to let me connect.
Do I need anything else open? Any ideas what's generating the 401?
I can post code if necessary, but like I said, it works on my PC and on the server I can telnet to the EWS on 443.
On the server, I'm running the app with my domain account logged in and a command prompt.
How do I debug further?

Configure SMTP Server to send mail

I have deployed a website (ASP.Net/C#) on my windows server 2012 R2 (it's a VPS and I installed IIS and SMTP), and everything works fine except one thing: I CANNOT send mail through my website!
I searched and tried everything but it still doesn't work! When I was debugging my application on local, it worked fine. Now I know I have to change my settings to send mail but I don't know what I should indicate
I'm sending my emails from a mail address that use pop3 server "relay.skynet.be" (this is the server I used when I was debugging and it worked) but when I do it on the website I got an error... So I changed it to the name of the server where my VPS is hosted (OVH) and it still doesn't work... I also changed the different credentials (in my code or in the SMTP in IIS) but the result is the same...
So I'm asking these questions:
In my code (C#), what should I indicate?? Which server should I indicate? And which credentials?
On Windows Server, in the SMTP settings in IIS, what should I choose? Should I indicate the e-mail address with which I send my emails? Do I have to check the "Use localhost" for the SMTP server to use or indicate the server of my mail address (relay.skynet.be) or the one from OVH? And for the credentials, what do I have to check? "Not required", "Windows" or "Specify Credentials" (with my mail address credentials?)
I have a strong feeling that you are simply missing the infrastructure - specifically, you are missing an SMTP server. SMTP server is responsible for delivering (or forwarding) your email.
Neither POP3 nor IMAP protocols are used for sending emails.
If this is the case, I suggest you try using hotmail or gmail mail account. You can find the settings for both here, respectively:
http://www.serversmtp.com/en/smtp-hotmail
http://www.serversmtp.com/en/smtp-gmail-configuration
Hope this helps.

Connecting to remote domino/lotus notes server to send/retrieve user mails, contacts, etc using C#

I am trying to create a web service using C#/.Net that can remotely access any user's lotus notes mailbox, contacts, etc. That is given the sever address and username/password details I want to send mails, create contacts, etc. Much like what one might do with EWS managed API for exchange accounts. I am currently using interop.domino.dll for this. It hasn't worked for me so far.
var session = new NotesSession();
session.InitializeUsingNotesUserName("username", "password");
var db = session.GetDatabase( "server", "xyz.nsf", false );
throws exception saying "user is not a server" or
"Failed to read server configuration"
I am a total lotus newbie and any help would be appreciated.
You mixed the server and client way to access the NotesSession. You have two choices:
Client Way
session.Initialize("password"); or session.Initialize();
Install a Notes Client and use Initialize(). If the client is started you do not need to provide a password. If the client is not started a password query will appear. The client is using the configured notes.id and needs that password. You could create a superuser id, that is capable to access all mail file and you do the authentication on your own. Initialize (NotesSession - LotusScript®)
This also should work on a server, but never tried this.
Server Way
session.InitializeUsingNotesUserName("username", "password");
I never tried this, but mistakenly used the method, so I know it's an error to use it with a client.
Theoretically: You Install a Domino Server and use the username and http-password of a user to identify as this user. I don't know if the dll find the right installation if you mix Notes Client and Server on on computer. Theoretically this could be controlled by the path variable, which executables the dll can reach via path. InitializeUsingNotesUserName (NotesSession - LotusScript®)
Domino Server on Windows Client: You can install a Domino Server on a Windows Client for testing purposes, the server will have limited network connections, because of the windows client, but it's utilizable for development. Bear in mind the EULA for Microsoft and IBM.
interop.domino.dll is not in focus of IBM any more. So think about what Richard Schwartz said and focus on the existing REST API or write your own web services as Notes Database and access it from C# as web service.

What does "Mail Enabled Sub-domain check failed" mean?

I am receiving the message "Mail Enabled Sub-domain check failed" when attempting to send emails via our internal SMTP server.
I am using the SMTP Client library in a VS2013 development environment. I've inherited the code and due to the confidential information contained in the actual configuration, unfortunately I am not at liberty to post it; but I can affirm that the settings for the SMTP Client are correct and I may be able to provide any additional information if it helps to answer the question as long as it doesn't require confidential data.
In past configurations, I have always authenticated directly to a specifically named SMTP server by providing the host and port information in the SMTPClient class instantiation.
This scenario is somewhat different because I've been informed that one of our other servers (A Web Server) where the application is running; is actually being passed as the SMTP Host for the SMTP Client connection.
But in actuality, I'd say it would technically be functioning as a Relay Server since it isn't an SMTP server.
Messages are submitted to our internal staff from the clients through a Popup Dialog that allows them to enter their message and click submit. The message gets sent to an internal email address and CC'd to the sender.
Upon debugging the program, no errors get thrown on the Send() method of the client.
I've tested this and the message must be hitting the SMTP server because I do get an email; however, instead of receiving the test message that I submit via the application; I get a message stating, "Delivery to the following recipients failed." with my email address in it and the email to where the message should be sent.
At the end of the message it says "Mail Enabled Sub-domain check failed"
I've searched online for this message but get no hits so it may be a message that is generated only within our organization; or maybe no one has posted the problem before.
In either case, can anyone provide any insight as to what this message likely means? I receive no errors in the System or Application event logs on the server. Maybe there are some other areas I need to check to make certain the Web server is properly configured to function as an SMTP relay server? I am unfamiliar with configuring a Web Server in this manner.
I'm at a loss for clues at this point.
I am posting this answer as it pertained to our particular situation. I'm fairly certain that the message may be somewhat of a blanket error; and so there may be other scenario's for which the error could be generated.
As previously stated, the SMTP host address that our application is using is actually the host address of the Web Server on which the application is running. The Web Server is also configured as an SMTP relay server, meaning any mail requests sent via the application uses the local host to relay the message to the actual SMTP Exchange Server.
After hours of troubleshooting to find the cause of the error it was identified that the Server Name was not in the correct format to leverage the SMTP Relay system.
For example, the host name that was used was in the format:
machinenameCNameAlias.subdomain.domain.com
when it should have been
actualMachineName.subdomain.domain.com
In other words, the use of a CNAME alias was not valid when using an SMTP Relay Server. (At least in our configuration)
Once the CNAME alias was replaced with the actual name of the server, the error was resolved.
I am obviously not an expert in any respect with the particulars of Exchange or it's Configuration counter parts; but after searching online with the keywords, "CNames and SMTP Relay Servers"; I did find other potential references; maybe inferring that CNAME aliases are discouraged with similar configuration types.
If anyone else can affirm these observations, that would be great.
But as for the particular scenario for which the question was initially posted, this was the answer for us.

Categories

Resources