I am using javax.mail.1.4.4 and i have set from address to
**MimeMessage mime = new MimeMessage(session)
mime.from = new InternetAddress(msg.fromAddress)**
When i tried fromaddress as "[email protected]" it will be sending below error.
**MAIL FROM:<[email protected]>
501 5.1.7 Bad sender address syntax
DEBUG SMTP: got response code 501, with response: 501 5.1.7 Bad sender address syntax
RSET
250 2.0.0 Ok
DEBUG SMTP: MessagingException while sending**
And in other case like "[email protected]" it is working properly.
Can anyone has any idea how to allow mail address like "[email protected]"?
deg-.com is not a valid domain name, which is probably why your mail server seems to be rejecting it. According to rfc-1034, domain name can be only of format
<domain> ::= <subdomain> | " "
<subdomain> ::= <label> | <subdomain> "." <label>
<label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]
<ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
<let-dig-hyp> ::= <let-dig> | "-"
<let-dig> ::= <letter> | <digit>
So the last character of domain name (leaving out tld) cannot be -
, it can only be a letter or a digit.
It's not related to javax.mail, such a domain name should not exist.