Contact form: bug with some SMTP servers
Recently, something changed at my host that caused the PHP contact form to stop working. As it turns out, the problem resides in the generated mailer.php file. The fix is to change this line:
$from = $reply_to = $_SESSION['form'][$mail_from_name]."<".$submitted_email.">";
to this:
$from = $reply_to = $_SESSION['form'][$mail_from_name];
I dug into the "Contact Form.rwplugin" file and made the necessary change, but it would be nice if you could fix this in your next update so I don't have to remember to apply the fix.
Comments are currently closed for this discussion. You can start a new one.
2 Posted by Aron Carroll on 04 May, 2010 02:33 PM
Hi Michael,
Thanks for your email, I'm sorry to hear you're having issues with the contact form. What was the exact error that was occurring when you tried to send the message?
Unfortunately we are unable to apply your supplied fix as it removes the email address from the
Fromfield of the email headers. The current format of{name} <{email}>is suitable for the header field according to the RFC specification, so it shouldn't be the formatting causing the issue.Did you speak to your host about what may have changed with their setup? Sometimes the
Fromfield must be set to a specific email address for the mail to send successfully.Looking forward to your response, hopefully we can get this resolved quickly.
Cheers,
Aron
Nik Fletcher closed this discussion on 10 May, 2010 09:15 AM.
Michael LaMorte re-opened this discussion on 12 May, 2010 10:10 PM
3 Posted by Michael LaMorte on 12 May, 2010 10:10 PM
Hi Aron,
The error I was getting was like this:
> F=<***@mindersoftworks.com> rejected after DATA: syntax error in 'Reply-To:' header when scanning for sender: malformed address: <***@mindersoftworks.com> may not follow ***@mindersoftworks.com in "***@mindersoftworks.com <***@mindersoftworks.com>"
Some Googling led me here: http://blackwidows.co.uk/blog/2006/10/02/reply-to-header-can-create-bounces/ which says in part:
> Correcting the script to format the Reply-To headers in line with RFC 822 solved the delivery problem!
>
> This suggests that some SMTP servers reject mails with Reply-To headers that don’t conform to the examples supplied in RFC 822. This is despite the fact that nothing within RFC 822 or RFC 2822 mandates a specfic format for Reply-To headers.
In an online support chat with my host, the tech said "nothing changed", though I find that hard to believe since everything was working fine with no changes on my part.
Now everything seems to be working again after re-publishing with the RW 4.4 update, except I have a page where I have an optional attachment. If the user submits the page but doesn't attach a file, they get this: "There has been an error attaching the file , please try again."
Attaching a file, the email sends with no problems.
Oddities abound!
Thanks for the help,
Mike
---
Michael A. LaMorte
Minder Softworks
a division of Springboard Enterprises Ltd
4 Posted by Aron Carroll on 13 May, 2010 09:50 AM
Hi Michael,
I believe the clue may lie in the line;
The RFC2822 spec indicates that the required format should be a readable name followed by the email address in brackets or just an email address on its own. I think the issue here is that it's parsing the former address and then choking on the second.
This can happen in RapidWeaver if in the Contact form settings both the "From Name" and "From Email" fields are set to the form field expecting the email address. Ideally the "From Name" field would be a form field expecting a name.
If you form does not have a suitable field to use for a name you can check the "Send email using your email address" box. This will ignore the "From Name" & "From Email" fields and just use the destination email as the "From" address, which will work around the issue.
I'd be interested in hearing your thoughts on the matter.
Cheers,
Aron
Nik Fletcher closed this discussion on 18 May, 2010 10:13 AM.