i'm trying to send email via google apps acc, using smtp server using c#, but i get error "Gmail Error :The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required". Now, most of the answers to this question are outdated and wrong, so let's unravel this mysterious detective. The truth that is up to date :
1) "lesssecureapps" settings are not available for google apps acc.
2) password is correct, login is correct.
3) people in google forums are lost themselves, they dont know anything about their product, its like talking to a dealer, that was caught be the cops - "i dont know anything", so no answers "ask in google forums".
4) in account activity, i see lots of "Account disabled", "Account enabled".
The Google Apps SMTP Relay Service can be configured to accept unencrypted and without username/password authentication. This would be the proper way to configure an internal server or application to send out mail from your domain and Google Apps.
Related
This isn't a code specific question, but more of a general question regarding OAuth2. I maintain a system that for the past 20+ years has been able to easily connect to any SMTP enabled email server, then send an email (only requiring authentication info and a server path). This email account is always system related, and isn't specific to one user, such as support#.
With GMail and Office365 (and other major email providers) dropping support for SMTP direct sends, I have been learning OAuth2. With all the reading I've done, OAuth2 is very email server specific (or so it seems). But from a systems standpoint, I need to be able to send support email regardless of whom is logged into the system, and regardless of what email host, with no authentication popups.
Is a single solution even possible with OAuth2? Will I need to code for every email provider differently? (GMail, Office365, etc) (I can currently get an authorization token from Office 365, but it seems very specific to Office 365) I have yet to figure out how to actually send an email through Office365 with my OAuth2 token, since MailKit doesn't seem to support OAuth. Is there a single protocol that will allow me to send an OAuth2 token through any email host?
I understand how SMTP direct send has been abused for a long time, but replacing it sucks.
I inherited a large .NET server application which contains code that is supposed to connect to a Sharepoint server. I know this code worked when the original developer wrote it, and it still works on the client's production machine, but fails with an authentication error ("The sign-in name or password does not match one in the Microsoft account system") when I run it on my workstation for development.
The Sharepoint code uses a WebClient. The relevant lines are these:
var client = new WebClient();
client.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f");
client.Credentials = GetSharePointCredentials();
The function "GetSharePointCredentials" returns an instance of ICredentials that is constructed from a username and a password. I know the username and password are correct, because I can go to the Sharepoint site in a web browser and log in with them.
I tried saying client.UseDefaultCredentials = true, but I didn't really expect it to work since my workstation is not signed on to any Windows domain that is associated with the Sharepoint server.
I do notice that the Sharepoint web application does a two-factor authentication when I log in that way (it sends a text message to the phone number of the account, which I have access to) and I suspect this might be part of the problem, although I think the X-FORMS_BASED_AUTH_ACCEPTED header is supposed to allow it to work without the phone number verification.
Unfortunately I am not the administrator of the Sharepoint instance or the domain, so I can't directly view or change their configuration, although I could ask someone for help if necessary.
Thanks,
Frank
Turns out my code was fine, but my IP address was being blocked by a firewall rule.
I am having an issue with sending an email through an app using Gmail. I have it working on a normal gmail account for development. Now I am moving the email over to the clients preferred email address also host by google but there is a twist with theirs that I cannot figure out. First off I have all the correct info for the address as well as enabled allow less secure apps enabled on the account. The issue is that to log into the account I type the email address into gmail like normal. Then I am redirected to a portal for identity verification and then once logged in there with a username and password I am redirected back to google where I can view the email account. Is there a way to get this to work through Mail.Net? I get it has to do with security but I am unsure what I'll need to do to get it to execute through the portal as well.
I have configured RabbitMQ but at the moment it is using simple username/password to connect to the queue. This isn't ideal as I'm having to store the password in the application config.
Ideally, I would like authentication to work like it does for an intranet application - using NTLM to implicitly pass my authentication to Rabbit.
I have enabled LDAP in the config which allows me to manage users in AD, but it still requires the password to be stored and sent.
Has anybody managed to get RabbitMQ authentication working with NTML (or Kerberos)?
Thanks
RabbitMQ does not support NTLM authentication at this time, as I noted in my response here on the rabbitmq-users mailing list.
Support could be added via a plugin, however.
NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.
I'm absolutely new to C#.
I'd like to write simple tray application that will check mail mailboxes for new mail. No extra functionality needed. Except maybe for opening a browser for specific account.
So far i tried TcpClient() and raw IMAP commands, but looks like i'm not allowed to:
* OK Gimap ready for requests from 80.235.87.101 k8mb64099440een
* NO [WEBALERT https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbvKabQnjALUA3Xdbjo28....Fgf4FIEg_33cqJJiB96NNrV8F_0MrM5A] Web login required.
tag NO [ALERT] Please log in via your web browser: http://support.google.com/mail/accounts/bin/answer.py?answer=78754 (Failure)
Then, I went to Google Developer Console, created a project, enabled Gmail API. But, the moment I saw quota limits, I started to ask myself - how would I go about releasing an open source app if there are operation quotas?
So the first question: is Gmail API there for business google accounts?
Secondly, is there any example on how could I just auth to check my private email to see if there are new messages or not?
Thank you.
On the quota issue
The default quota limits are pretty high and largely to protect Google infrastructure. They can be raised by filing out the request. IMAP has similar limits just not documented as clearly.
If you use the Gmail API with history.list() to poll for updates it'll be more efficient/cheaper than with IMAP. Should easily support hundreds of thousands of users of said app.
That said, oauth2 for installed apps (Gmail API or IMAP or anything) has a clear deficiency in that anyone that installs the app can basically make calls and eat up quota. Thunderbird and other open-source things (even those that use IMAP with oauth2) have similar problems...
first question
yes, Gmail API is for business google accounts (Apps for Work) as well as normal user #gmail.com accounts.
second question
there are quickstarts for a number of languages including c#
https://developers.google.com/gmail/api/quickstart/
that should get you through the basics (auth, setting up API). you may need to look at the java/python quickstarts if something isn't covered as extensively in the C# docs. for checking for updates on a mailbox see this guide:
https://developers.google.com/gmail/api/guides/sync
For accessing Gmail details via code you need to allow access to emails by enabling pop3 or IMAP settings in your account Screen shot for enabling POP# or IMAP settings in Gmail account
Turn On Access for less secure apps in the Gmail account.
Enable for less secure app by clicking on to the following link
https://support.google.com/accounts/answer/6010255?hl=en-GB
Then , you wont get error such as " NO [WEBALERT ....] "