Sending Email from .NET using windows live smtp - asp.net-mvc

I have configured smtp settings in web.config and I was able to successfully send email when working on my local machine. But when I uploaded the code on the server, its giving me following exception
Mailbox unavailable. The server response was: 5.7.3 Requested action aborted
Meanwhile, I also received an email from Microsoft telling me that an attempt to login to my account from a new location was blocked. I clearly understand the problem that server is in a different part of the world than where I usually login to a Windows Live account. That's why it is blocking the account to login. But I want it to login and send email using my credentials on from remote server. There must be some settings in Windows Live account but I failed to find one.

Contacting Hotmail Support Center first to find out if its really possible what you are intending to do might be helpful. I think if hotmail web administration has put a security check, it must be for a purpose of stopping such remote login activities.

Related

Connecting using SnowSQL denied 403 error

I am trying to configure JDBC but kept getting the same error I am getting using snowsql:
250001 (08001): Failed to connect to DB. Verify the account name is correct: JG3409.canada-central.azure.snowflakecomputing.com:443. 000403: 403: HTTP 403: Forbidden
If the error message is unclear, enable logging using -o log_level=DEBUG and see the log to find out the cause. Contact support for further help.
Goodbye!
I have configured the config file, and I have double checked the account, company, region, reset password to only use alphanumeric.
I have used both forms of the URL
The only possibility is that I am using a trial account, but I can't imagine that this would limit external non-browser connections?
I use a simple user/password, I have whitelisted my IP and I don't have a problem with a proxy or a firewall. I can successfully connect using a browser.. using:
https://app.snowflake.com/canada-central.azure/jg63409
Important contents of the config file:
[connections]
accountname=JG3409
#accountname=uegxydq-pz20606
region=canada-central.azure
username=ASHSNOWFLAKE
any ideas?
Your account is not JG3409 but JG63409 based on this link:
https://app.snowflake.com/canada-central.azure/jg63409
Try in your browser:
https://jg63409.canada-central.azure.snowflakecomputing.com
I found out using snowcd that my computer could not connect via my home router.
When I used my personal hotspot on my (5G) phone, snowcd passed all the tests immediately. The problem then arose how to adjust the network security policy to allow a CIDR block of network addresses through since my phone uses a new address every time I connect, and I can't edit the policy to allow my phone while connected via my phone (for obvious reasons)
Catch 22
123.45.0.0/16 is not accepted in the new Snowflake UI, and 0.0.0.0 doesn't work for me, but the documentation gave me a clue.. the new UI doesn't separate by commas, so I switched to the old UI and voila!
Incidentally the OLD UI uses the same URL as SnowSQL so I picked up my error in my account number there as well (although I should have seen it earlier).
Diabolical but thanks #Sergiu too!

Symfony send mail error (Mailer and SwiftMailer)

I'm trying to send emails in my Symfony 4.4 app, I tryed both Mailer and SwiftMailer.
The app is running inside a Docker container, with shared ports 80 and 3306.
If I try the console command with SwiftMailer I get this:
bin/console swiftmailer:email:send --from=ex#example.com --to=ex#example.com --subject=hi --body=hi
[OK] 1 emails were successfully sent.
And after a while I get:
ERROR [app] Exception occurred while flushing email queue: Expected response code 250 but got code "554", with message "554 5.2.0 STOREDRV.Submission.Exception:SendAsDeniedException.MapiExceptionSendAsDenied; Failed to process message due to a permanent exception with message Cannot submit message. [Hostname=XXXX.eurprd04.prod.outlook.com]
This happens with other email providers also, and both, in Mailer and SwiftMailer.
The fact that I get an (error) response from the service provider (Outlook in this case) makes me think that is not a port problem, as the email did actually reach the provider.
Any ideas? I'm quite stuck on this.
Thank you.
This is an outlook365 issue, your authentication account is different to the From address, this is forbidden unless you explicitly grant permission to do so.
You can easily solve this by using the same From address as the account you are using to authenticate. Otherwise, you'll need to grant SendAs permission or SendOnBehalf.
Given your example, you need to set the permission on the ex#example.com mailbox, and grant it to the authuser#example.com user as configured in your env.
You need to do this for as many mailboxes as you want the authuser to be able to send mail as.
To check the configuration, you can access Office 365 as the authuser and try changing the From address when composing a new email. You should see all addresses that have granted permission to that user.

Microsoft Graph - Email Delivery Failure when using sendMail API

I'm having issue with https://graph.microsoft.com/v1.0/users/<userId>/sendMail.
I get 202 Accepted as response, however when I browsed to the user's mailbox above, I'm receiving delivery failure notification as below:
Delivery has failed to these recipients or groups:
<username>#outlook.com
Your message wasn't delivered because the recipient's email provider rejected it.
Remote Server returned '550 5.7.708 Service unavailable. Access denied, traffic not accepted from this IP. For more information please go to http://go.microsoft.com/fwlink/?LinkId=526653 AS(7171) [SYBPR01MB4428.ausprd01.prod.outlook.com]'
When I logon to Outlook and send email to <username>#outlook.com from <userId>'s Outlook, the email was sent successfully.
Anyone know what's happening here?
I've tried to add a SMTP connector, but doesn't fixed the problem. When SMTP connector send an email to test Outbound Email, it works fine as I can receive at <_username_>#outlook.com.
If you follow the link provided, it explains what is happening
5.7.708 Access denied, traffic not accepted from this IP
The majority of traffic from this tenant has been detected as suspicious and has resulted in a ban on sending ability for the tenant.
Ensure that any compromises or open relays have been resolved, and then contact support through your regular channel.
For more information, see Fix email delivery issues for error codes 5.7.700 through 5.7.750 in Exchange Online.

Sending email to the "outside world" from localhost using hMailServer and Gmail SMTP on Windows 7

I am not sure if this is technically possible but I am running a AMPPS box on Windows 7 as my localhost and I have configured it with Gmail SMTP (ssl://smtp.gmail.com) to send out email from my PHP scripts like joomla, wordpress, socialengine, etc.
Now I installed and setup hMailServer and I am able to send and receive emails locally but was wondering if there was a simple way that I could configure my localhost and email server to send out email to outside world (e.g. #hotmail.com or #yahoo.com receipients) using Gmail SMTP?
Currently with my setup, I am only able to receive installation confirmation emails from AMPPS but nothing else like "Forget Password" or "User Registration Forms" work.
Any ideas without getting too deep into code modification?
The simple answer is no, or rather it is far from easy, especially from a home based server.
And the reason is that your IP address amd mail server domain will not be considered as a ligitimate mail server by most of the legitimate mailservers you will be trying to send mail to, and they will just reject it as yet another spam server.
Have a look at these:
https://serverfault.com/questions/72559/setting-up-a-mail-server-best-practices-to-be-recognized-as-legitimate
How to conduct legitimate email campaigns

Suspicious sign in prevented (Heroku, Amazon AWS, Gmail SMTP)

I occasionally receive emails from Google (accounts-noreply#google.com), similar to the following:
Subject: Suspicious sign in prevented
Someone recently tried to use an application to sign in to your Google
Account, ________#gmail.com. We prevented the sign-in attempt in case
this was a hijacker trying to access your account. Please review the
details of the sign-in attempt:
Monday, November 19, 2012 8:40:55 PM GMT
IP Address: 184.72.161.49 (amazonaws.com)
Location: Dixmoor, IL, USA
If you do not recognize this sign-in attempt, someone else might be trying
to access your account. You should sign in to your account and reset your
password immediately. Find out how at
http://support.google.com/accounts?p=reset_pw
If this was you, and you want to give this application access to your
account, complete the troubleshooting steps listed at
http://support.google.com/mail?p=client_login
Sincerely,
The Google Accounts Team
© 2012 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
You have received this mandatory email service announcement to update you
about important changes to your Google product or account.
Indeed, this was me, as I have an app running on Heroku (hence why the IP address is from amazonaws.com), and I send email directly from my app via Gmail SMTP (I don't think it should matter, but specifically, I'm using the gmail_smtp plugin which I updated for Rails 3.2).
Is there a way to avoid this warning, or a way to whitelist known IPs?
Short Answer
In a web browser (perhaps Chrome/Incognito), log into your Gmail account (the one via which you're trying to send email from your app).
In another browser tab, open https://accounts.google.com/DisplayUnlockCaptcha -- and follow the steps.
Long Answer
I ended up logging into my Gmail account (mentioned as ________#gmail.com in the Stackoverflow question above) and saw the following warning:
[Note: I'm piecing this Answer together after the fact.] Clicking the link Was it you?, I'm pretty sure I was taken to a page that contained the following, though below it there was a message and button about adding another application to the list:
[Again, I'm pretty sure...] Clicking the button on that page brought me to https://accounts.google.com/DisplayUnlockCaptcha -- which looks like this:
Clicking Continue brought me to another page:
At that point I just went to my app, and made it send an email.
Note: for general live-testing of email in my app, I have a view at triggers#index with two buttons that send PUT requests to these actions: triggers#send_email and triggers#raise_exception. This enables an admin to go to /triggers and send an email or raise an exception to test if the production system is working correctly as far as being able to send email is concerned. Raising an exception in any of my apps emails details to me via exception_notification.
I had the same problem when I tried sending emails through Gmail SMTP using PHP. You shoud complete the troubleshooting steps provided at the end of the email.
On your Gmail mail box look at the bottom right corner and you can see a Details button. Click on it and then on the pop up window change the suspicious warning settings.
To get this working in dev with Rails 4 i had to enable access for less secure apps.
Visit https://www.google.com/settings/security/lesssecureapps while signed on to your gmail account and click 'turn on'. Note, this enables access for less secure apps which could come with unintended consequences.
Some apps and devices use less secure sign-in technology, which makes
your account more vulnerable. You can turn off access for these apps,
which we recommend, or turn on access if you want to use them despite
the risks.
To get this working in Rails 4, in addition to enabling access for less secure apps, as described already (Visit https://www.google.com/settings/security/lesssecureapps while signed on to your gmail account and click 'turn on'. Note, this enables access for less secure apps which could come with unintended consequences.),
one more step may be required in some cases, if account access is still blocked.
If this is the case, also visit https://accounts.google.com/DisplayUnlockCaptcha and click continue, to enable account access to send via gmail SMTP.
Credit to Steve Polito

Resources