Question
Why won't PHP Mail send emails to hyphenated email addresses (e.g. digital-ocean@hotmail.com)
It works fine with email addresses without hyphens (e.g. digitalocean@hotmail.com). Does anyone know a possible cause for this?
Please ask if you need any more information.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×
Can you share a sample of the code attempting to send the messages?
I have never encountered this myself when sending emails via php but some googling found a number of people reporting similar issues and the primary suggestions I found there were:
digital\-ocean@example.org
"digital-ocean@example.org"
<digital-ocean@example.org>
Here is the script. As you can see I’m using PHP Mailer
Thanks.
Looking at PHPMailer’s source code, it appears to encode a recipient email address only if there is a name. Try passing a name to addAddress(), does that work?
I tried that and it didn’t work. I think it says somewhere that the name isn’t required anyway.
Now I can’t send emails at all. I get this line in my mail.log