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

Test email notifications on localhost dev install

RichardKYA

Well-known member
#1
Hey everyone,

Is it possible to test e-mail notifications on a local machine using xampp?

I've tried searching online to find an answer and I've tried making changes to xamppfiles/etc/php.ini file as a few articles have suggested, but I have no idea if I've done it correctly/need to do something else or if it's just my add on code that is not working. That said, I've tried watching a thread with e-mail notifications, making a new post and that hasn't been sent either, so I'm assuming it's the set up. I also tested this before making any changes to the php.ini, but I have no real way of knowing because I'm not receiving any errors or any confirmation either, so I'm left scratching my bald head and wishing that I still had hair.

If it helps, I'm using a macbook pro with El Capitan and XAMPP 7.0.4-0.

Any help or tips would be greatly appreciated

Thank you in advanced :)
 

Brogan

XenForo moderator
Staff member
#2
You would probably need to install a mail transfer agent such as Postfix or SendMail and configure PHP to use it correctly (sendmail_path).

Also, make sure you don't have this in the config.php file:
PHP:
$config['enableMail'] = false;
 

Chris D

XenForo developer
Staff member
#3
I highly recommend "MailTrap":

https://mailtrap.io/pricing

The free usage tier should be about enough for basic email testing.

Sign up, it provides you with a specific SMTP server and username and password, add that to your Email Options in XF as you normally would, and all emails sent via XF (regardless of the recipient) will be delivered to your MailTrap inbox, where you can view how the mail would look in HTML and text format.
 

RichardKYA

Well-known member
#4
Hi @Brogan,

Yeah, I updated my config.php and one of the things I done in the php.ini was add:

Code:
sendmail_path = "env -i /usr/sbin/sendmail -t -i"
Which apparently is what other mac users have added to get it working. I did read something about postfix, but it also said something about security issues with it, so I didn't look too much further into it.

Hi @Chris,

That sounds great, I will give that a go (y)

Thank you both for your responses
 

RichardKYA

Well-known member
#5
Hi @Chris,

Sorry to be a pain.

I've signed up to mailtrap and added the credentials to the ACP > Email Options and although an attempt to send the email is being made, I keep receiving this error in log:

Code:
Zend_Mail_Protocol_Exception: Email to name@domain.com failed: ' mailtrap.io' appears to be a DNS hostname but cannot match against hostname schema for TLD 'io', ' mailtrap.io' does not appear to be a valid URI hostname, ' mailtrap.io' does not appear to be a valid local network name - library/Zend/Mail/Protocol/Abstract.php:145
Generated By: Unknown Account, 2 minutes ago
Here's the credentials it provided:

mailtrap.jpg

ACP > Email Options:

Screen Shot 2016-07-28 at 15.19.54.jpg


I've tried it with and without the optional TLS encryption, but still have the same result.

Any ideas on what I am getting wrong?

Thank you
 

Chris D

XenForo developer
Staff member
#6
There appears to be a space before the hostname.

The error suggests it is ' mailtrap.io' rather than 'mailtrap.io'.

That said, it seems to be complaining about the '.io' TLD rather than the hostname itself. If it genuinely is that it's complaining about you will need to see if they offer an alternative hostname, or use its IP address directly. Based on a ping I just did, that may well be 52.5.202.66.
 

RichardKYA

Well-known member
#7
Yep, it had a space in front of it lol

That's what you get for copying and pasting stuff. The irony is, I copied and pasted so that I wouldn't get it wrong :ROFLMAO:

Anyway, with my dumbassery over, things seems to be working well and my add on sends the e-mails just fine *High five*

Brilliant recommendation of Mailtrap by the way, it was so easy to sign up and if it wasn't for my simple error, this would have been up and running in less than 3mins, so *high ten* for that

Thanks again for your help