I'm sending email to mailtrap in this way
$mail = new Zend_Mail();
$mail->setFrom("[email protected]", 'Temporary sender name');
I am already using mail trap for a lot of projects, so I know that I can send email using these email address and name as "from"
What doesn't works
The problem is that $mail->send() throws an Exception
5.1.7 Bad sender address syntax
Little debug
So I debugged Zend code. I am now sure it's sending from as
Temporary sender name <[email protected]>
I also tried avoiding litteral name, so using only
$mail->setFrom("[email protected]");
The header is written using only
<[email protected]>
But nothing changed
What I'm not understanding
I am not able to understand if this very old Zend project is NOT sending at all the message or if Mailtrap is refusing.
Questions
- What is wrong with this sender address ?
- Is this an error from Zend_Mail or from Mailtrap?
- And obviously, how to fix ?
You can try this way: