Forum
Get Mailtrap working with live server
Hi,
I can get Mailtrap working great with my local server (test email works and I can see it in their dashboard).
However, I cannot get it to work on a live site, getting an SMTP connect() failed
message. FYI the hosting is GoDaddy (not my choice).
I've seen someone had a similar problem here https://forum.grabaperch.com/forum/05-20-2015-smtp-connection-error-for-mailtrap-mamp.
I've tried changing the port number and also switching between SSL and TLS but unlike the person asking the other question I haven't found a different combination that works.
My question is what are the next steps for trying to get this to work? Where could I view diagnostics? How can I troubleshoot this?
Here are my Mailtrap settings that work locally:
define('PERCH_EMAIL_FROM', 'mailtrap@jaygeorge.co.uk');
define('PERCH_EMAIL_FROM_NAME', 'Jay George');
define('PERCH_EMAIL_METHOD', 'smtp');
define('PERCH_EMAIL_HOST', 'smtp.mailtrap.io');
define('PERCH_EMAIL_SECURE', 'tls');
define('PERCH_EMAIL_AUTH', true);
define('PERCH_EMAIL_PORT', 2525);
define('PERCH_EMAIL_USERNAME', 'xxx');
define('PERCH_EMAIL_PASSWORD', 'xxx');
Depending on your (their) GoDaddy hosting plan, you may not be able to use an external SMTP server at all - they block everything. If it's a basic plan, you can only use a GoDaddy SMTP server.
Thanks Duncan, I'll check with them and reply here when I receive an answer.
I've finally managed to get this working with their mail server, but only locally(!).
These are the sanitised GoDaddy details. Any idea why this would be working locally and not on the live server? When going to the admin > Settings > Email and testing, I get a
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
message.Jay, were you able to get the email working on the live site with perch default setup before adding the mailtrap smtp settings?
I always like to setup perch or runway default then begin to dress it out with options, this way I know I am troubleshooting the additions and not perch itself.
BTW, My default setup uses mailtrap for dev, both online and local and works great, so I can say it works.... just cant seem to see why not in your case.
Thanks Robert. If I just leave the
email from
and andfrom name
in, sending a "test email" works, but oddly sending an admin notification after a form has been submitted does not work.Do you know if the "Email test" and form submission use different methods to send an email?
Both use
PerchEmail.class
, which decides the method based on whats available on the server and settings. So if one works the other should too... so I have to think this is a setting error on the Forms App. First go with the simplest test of Sending a Notice to admin of submitted form, then progress to adding autoreply... and so on. Also, If you have the members app installed... Is it working to send Moderator Email for new member signup, as this again will use the same methods as the Forms app would to send email. At least this way you can determine ifANY
apps can send email.My contact form settings in the admin are very simple so I'm not sure why it wouldn't work :-/
Here is a screenshot of the settings: https://www.dropbox.com/s/di7n2z8vennz07t/form%20settings.png?dl=0
Is there some other way to debug what happens when the form gets submitted? This stuff is a bit beyond me and I'm not sure where else to go with it.
FYI I temporarily turned on
define('PERCH_DEBUG', true);
on the live site but couldn't see any sort of errors when I submitted a contact form. Although I'm not sure if anything should normally show there if something fails.Ah ok, I realised how you can output the debug on the page. Once the form has been submitted this is the full debug I get:
It looks like the email is being sent.
As Drew says, it looks as if the message has been sent, and then perch goes on to store the form submission in the database.
Jay,
I don't know if this will help (especially with the test working but the form not working), but I had trouble helping someone out with GoDaddy. It wasn't Perch, but was using PHPMailer - the host I ended up having to use was the full, internal mail server name - like the following:
letterandnumbers.prod.phx3.secureserver.net
Before that I was getting the same error as you though. You can find the full name from somewhere in the cpanel.
Google Search: using mailtrap with godaddy
Result:
link to result
https://mailtrap.uservoice.com/forums/142303-general/suggestions/13611240-add-api-endpoint-for-accepting-email
Thanks both, that somewhat clears up why I'm having issues.
It still doesn't explain why I'm not receiving any of the notification emails while Perch is claiming they've been sent. I've tried changing the the send-to address and checking spam, but nothing ¯_(ツ)_/¯.
I do not have access to the cPanel for this client (it's with their IT company) so at the moment I've asked for the full internal server name as Duncan suggested.
Let's see if that changes anything.