• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 Contact Form and Amazon Web Services (SES)

robdog

Well-known member
#1
I use Amazon Web Services to send all email through my forums. With the recent updates, I am getting a verified error when someone fills out the contact form.

Amazon returns this error when the email address sending the email is not verified. Did something change with the contact form? Is the from fiend, the email address the user enters into the contact form?

Can we change the from email address to the default email address and set the reply to field to the value entered by the person filling out the contact form?

Anyone else use AWS for sending email and running into the same problem?
 

Andy.N

Well-known member
#2
It has been noted before and Mike said there is nothing XF can do about it until AWA SES allow the option to send from a different address.
 

robdog

Well-known member
#5
http://xenforo.com/community/thread...-with-amazon-ses-or-other-smtp-service.32308/
Yes I read that amazon discussion before but there is no update on whether Amazon will support it.
They do support it. Here is the developers comments who implemented it:
Community members gave us input that the limitations on the Reply-To header weren't working for them. We have heard this feedback loud and clear.

We have removed the email address verification requirements of the Reply-To header. You can now use any email address.

Community feedback is extremely important to the team at Amazon SES. Please keep it coming! We read all of your suggestions and consider them carefully while planning upcoming Amazon SES features.
 

Mike

XenForo developer
Staff member
#6
He's referring to the Sender header, which is the "correct" way of doing this - it's basically the exact situation it was designed for.
 

robdog

Well-known member
#7
Ah, well. Can always extend this functionality to do what I want. :)

Will update this thread when I can get the reply-to field working properly.
 

hqarrse

Active member
#9
I have mine working with a nasty code hack - I had the same problem with VBulletin and have just done the same quick fix. SES will not accept the Sender header for me, and only allows email through if it is form my domain. (this is possibly related to my setup as I use postfix as local relay to run a queue on the server that allows me to better handle the delays in sending batch email across the Atlantic, rather than trying to connect to SES directly from XF/PHP via SMTP).

The hack is to change line 394 of library/XenForo/ControllerPublic/Misc.php and change what gets sent to the mail() method of XF's mail class. As below (original line commented out, replacement below)

PHP:
 /* $mail->send(
                                XenForo_Application::get('options')->contactEmailAddress, '', array(
                                        'Sender' => XenForo_Application::get('options')->contactEmailAddress
                                ),
                                $user['email'], $user['username']
                        );*/
                        $mail->send(
                                XenForo_Application::get('options')->contactEmailAddress, '', array(
                                        'Reply-To' => $user['email']
                                ),
                                XenForo_Application::get('options')->contactEmailAddress, $user['username']
                        );
The change sets the 'from' as your site admin address, which gets it through SES, then the 'Reply-To' header means that when you answer it goes to the right place.

I'm very new to XF and am just getting ready for my first import from VB. I'm also not a PHP developer so I am not about to try and make the above a more correct modification - I assume method overrides are catered for? I would be grateful if someone else would though, so that when I upgrade I don't have to bodge it again!
 

thedude

Well-known member
#10
I have mine working with a nasty code hack - I had the same problem with VBulletin and have just done the same quick fix. SES will not accept the Sender header for me, and only allows email through if it is form my domain. (this is possibly related to my setup as I use postfix as local relay to run a queue on the server that allows me to better handle the delays in sending batch email across the Atlantic, rather than trying to connect to SES directly from XF/PHP via SMTP).

The hack is to change line 394 of library/XenForo/ControllerPublic/Misc.php and change what gets sent to the mail() method of XF's mail class. As below (original line commented out, replacement below)

PHP:
 /* $mail->send(
                                XenForo_Application::get('options')->contactEmailAddress, '', array(
                                        'Sender' => XenForo_Application::get('options')->contactEmailAddress
                                ),
                                $user['email'], $user['username']
                        );*/
                        $mail->send(
                                XenForo_Application::get('options')->contactEmailAddress, '', array(
                                        'Reply-To' => $user['email']
                                ),
                                XenForo_Application::get('options')->contactEmailAddress, $user['username']
                        );
The change sets the 'from' as your site admin address, which gets it through SES, then the 'Reply-To' header means that when you answer it goes to the right place.

I'm very new to XF and am just getting ready for my first import from VB. I'm also not a PHP developer so I am not about to try and make the above a more correct modification - I assume method overrides are catered for? I would be grateful if someone else would though, so that when I upgrade I don't have to bodge it again!
Just a heads up, the line is 194, not 394. The reply-to method works well