Disable javamail email address validation - email

Id like my application to have bare minimum 'To' email address validation, that is only empty string is considered to be invalid. All the below strings are to be considered as valid email addresses from my application perspective:
adas.assa.com
sdaassa.com
sada
Im using spring-boot-mail starter to develop my application, and MimeMessageHelper to construct the mail message. And java mail api would issue sendFailedException Invalid Address, when I tried to send email to those addresses. From my digging it seems that there are already built in email address validations. Is there any way that I can disable the email address validations, so that my application still send email to those addresses?
Update since #Bill Shannon:-
I've updated my properties file as so:
spring.mail.properties.mail.mime.address.strict=false
Im still getting the error:
org.springframework.mail.MailSendException: Failed messages:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
com.sun.mail.smtp.SMTPAddressFailedException: 501 5.1.3 Invalid address
Im not sure if it has to do with how I pass the session properties as you #Bill mentioned, or coming from exhange server address validation(can we tell from the error?).
Update after checking with exchanger server admin.
It works. The error received actually issue by email server. You have to get your email server to disable email address validation to make it work.

Try setting the Session property mail.mime.address.strict to "false". Still, it's up to your mail server whether it will accept those addresses.

Related

Outlook emails sent to invalid email with URL in them get clicked

We are deploying an app where after signing-up you receive an email to a URL with a token that will call an API that simply switches a bool in the DB called confirmed. There is no other way to alter this bool other than through this API.
We recently switched our gmail smtp to an outlook365 one and discovered that any email that is invalid gets this boolean toggled. To be more specific I've noticed that there are two types of invalid emails:
One where we receive an email from Microsoft Outlook
Your message to test#whatever.com couldn't be delivered.
test wasn't found at whatever.com.
and another where we receive the same email from postmaster#officedepot.onmicrosoft.com
Only the ones received from postmaster are getting validated.
I believe the links are somehow automatically being called?
Could anyone validate my theory?

553 5.1.3 The recipient address is not a valid RFC-5321 address

When sending bulk emails I was receiving several error messages that said:
553 5.1.3 The recipient address <john#example.com > is not a valid RFC-5321 address.
The format of the email addresses looked completely valid so I couldn't figure out at first why these messages weren't being delivered.
Upon further inspection, I noticed that the recipient email addresses for each of the failed messages had a single space on the end. It's not as hard to see in the example I provided above, but the error report I was viewing had smaller font and would sometimes put a line break where the space was, so it wasn't as obvious. By the way, I was using the SendGrid API to send these emails, but I don't think that the issue would be unique to using SendGrid.
if you are using node.js API for sending emails to people, you just need to add .trimRight() to your recipients email address in your API, so in this way the white space will be removed and you can successfully send your email. :)
I was using Django Restful Api and my mistake was, when registering the users, I had interchanged the email field with the username field. So the Smtp server was using the username as the email address used to send the verification emails. I corrected that interchanged the fields correctly and it worked.

Mailbox unavailable. The server response was: This domain is not hosted here

I am performing some tests on my Nopcommerce site that should allow the user to type a message in to the contact box of the site and that message should be sent by email to a user.
When setting up and testing said user on the site, I am able to perform an email test against an internal email address and this works fine, I receive the email. However, if I try and send the email to an external email address, such as hotmail etc, I receive no error logs at all.
Has anyone ever come across this issue when trying to set up an email on a Nopcommerce site?
I am using port 25 however I have tried to use port 587 with no luck
The answer was that the username and password no longer existed for the server I was sending mail from. Moreover, another issue I had was that the mail still wasn't sending and was sitting in the Message queue. To overcome this I had to make sure that the bindings for the site on IIS were identical to the host values on the site. Doing this allowed me to send mail.

Email Sending Failed sending to prod.protection.outlook.com

I keep getting these bounce backs, works on any other domain gmail, yahoo but not outlook/hotmail. is it me or them? I am using Smartermail with all possible settings setup ie DKIM SPF ii basically get a perfect score on https://www.mail-tester.com/web-zorml
Could not deliver message to the following recipient(s):
Failed Recipient: xxxxxxxxxxxxxxxxxxxxxx
Reason: Remote host said: 501 5.5.4 Invalid domain name [DB5EUR03FT018.eop-
EUR03.prod.protection.outlook.com]
prod.protection.outlook.com is Outlook/Microsoft's anti-snooping service. In case you didn't know, by viewing an email header, you can see the sender's IP. In order to circumvent this, Microsoft/Outlook sends your emails to prod.protection.outlook.com and then to the recipient, so if someone views the header, they get prod.protection.outlook.com's IP instead of yours. My guess is that your email provider doesn't recognise prod.protection.outlook.com as a valid domain name and thus can't send the email.

How to make sure that the email was sent in yii2?

In my project when the user stored a new record to database, sent to him email with to perform afterSave() Method.
How to make sure that the email was sent?
I don't think this is something to do with yii2 or the afterSave() event (as long as the afterSave event is triggered, which you can verify by Runtime Logging for example). When using PHPMailer class you can see this discussion about making sure an email has been sent.
$mail->send() will not always return true. It returns true if the part of the sending process it was involved with works. So if you send to an unknown address, but do so via gmail, gmail's servers don't know whether the address exists or not at the time, so it will be accepted and bounced later. If you were sending to a gmail address when sending through gmail, then it would fail immediately.
If an account does not exist at all, most servers (including gmail) will still give a 5.1.1 "Unknown user" response, and that will be reported correctly by PHPMailer if you send by SMTP directly to the recipient's supposed mail server (but not if you send via an intermediate server (like gmail) or using mail()). PHPMailer doesn't have built-in support for doing that, but doing it yourself only involves a call to getmxrr and setting Host manually. Also you won't need to use authentication if you send that way.
You can do various things like check if a domain exists at all - if it doesn't, mail delivery won't work. Some servers will accept all addresses and send bounces later (e.g. if they have a spam filter with a long processing queue), but if you get rejected up-front, it's a pretty sure indication that the address doesn't exist.
You need to look into bounce handling too which will allow you to remove addresses that looked ok but later proved not to be, which is an entirely separate thing from anything that PHPMailer does. I will warn you now - bounce handling is extremely unpleasant!
You should also send using tls on port 587, not ssl on 465; see the gmail example provided with PHPMailer.
I would also recommend you to send mails via an SMTP auth connection trough PHPMailer.