XF 2.0 Email Help

TheSalt

Active member
Hello Folks,

I'm having a problem setting up outgoing email on XF v2.0.12. Admittedly, I know very little about all this stuff but I literally spent all last week trying to figure it out. Currently, I created and verified a mailgun account using a subdomain per their suggestion (mail.mydomain.com). All the DNS verification stuff has been entered into my cpanel and is 'active' and showing green on all the TXT, MX, and CNAME on mailgun. On XF I have tried using default email addresses such as email@mail.mydomain.com, admin@mydomain.com, info@mydomain.com. I tried using the default with and without -f parameter. I tried using SMTP but I keep getting an error message on XF stating it's not able to connect to mailgun. I'm not showing any bounced or sent emails on the mailgun log. When using the SMTP, I'm using the mailgun info, not my host email client info. In my research, I found people mentioning having to do something to a config file but I haven't done anything like that yet. Also, I should mention I'm using namecheap and am on shared hosting.

Thank you for any info!
 
Have you checked the ports and they're working correctly?
A lot (most) of shared hosting providers close the email ports to prevent spam.
Could be an idea to make sure they're open.
 
If XF is going to take a handoff approach to outgoing mail it would really be helpful if they had some kind of resource we could give to our hosts to make sure all the needs are met on their end to allow XF mail to run properly. Maybe XF has such a resource, I don't know? Understandably, most hosts turn away any questions when it comes to 3rd party software. I understand that XF doesn't want to help everyone with this problem as servers are setup differently but how are we supposed to know what to ask our hosts for? There is so little info on this major part of running a forum that I feel I must be missing something very simple to everyone else. This is my second forum with XF and I had the same problem before, back then I ended up using BD Mails but that is not available for FX 2.0. I would really love to understand this problem and how to fix it. I'm now on week two of trying to understand this.
 
At a base line, we generally just recommend using the default PHP mail system, which should send emails without issue, provided your PHP install has been configured as expected (which would be your host's responsibility). If that doesn't appear to send emails but XF doesn't error, then mail has been handed off successfully and your host should be able to identify issues via the mail log.

If you want to use SMTP, there are a lot of variables, most of which are server-related (or mail provider-related), so it's really hard for us to give any sort of one-size-fits-all advice.

You haven't actually provided the error message you're receiving. You mention it's not able to connect, which would generally point to a network-level issue. As mentioned, some hosting providers block outgoing connections on specific ports. We have no means to know whether that's the case though -- that's something very particular to your host.
 
A quick google search revealed that Namecheap blocks port 25 for outbound SMTP on their shared servers. You'll need to make sure you are using something like port 465 for SSL or port 587 for TLS.
 
At a base line, we generally just recommend using the default PHP mail system, which should send emails without issue, provided your PHP install has been configured as expected (which would be your host's responsibility). If that doesn't appear to send emails but XF doesn't error, then mail has been handed off successfully and your host should be able to identify issues via the mail log.

If you want to use SMTP, there are a lot of variables, most of which are server-related (or mail provider-related), so it's really hard for us to give any sort of one-size-fits-all advice.

You haven't actually provided the error message you're receiving. You mention it's not able to connect, which would generally point to a network-level issue. As mentioned, some hosting providers block outgoing connections on specific ports. We have no means to know whether that's the case though -- that's something very particular to your host.

Thank you for this info! I will pass it on to Namecheap.
 
At a base line, we generally just recommend using the default PHP mail system, which should send emails without issue, provided your PHP install has been configured as expected (which would be your host's responsibility). If that doesn't appear to send emails but XF doesn't error, then mail has been handed off successfully and your host should be able to identify issues via the mail log.

If you want to use SMTP, there are a lot of variables, most of which are server-related (or mail provider-related), so it's really hard for us to give any sort of one-size-fits-all advice.

You haven't actually provided the error message you're receiving. You mention it's not able to connect, which would generally point to a network-level issue. As mentioned, some hosting providers block outgoing connections on specific ports. We have no means to know whether that's the case though -- that's something very particular to your host.

Hello Again,
Using mailgun and STMP, port 587 TLS I received this error.


Swift_TransportException: Email to email@yahoo.com failed: Connection could not be established with host smtp.mailgun.org [Connection refused #111]
src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:277

Stack trace
PHP:
#0 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(62): Swift_Transport_StreamBuffer->_establishSocketConnection()
#1 src/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(113): Swift_Transport_StreamBuffer->initialize(Array)
#2 src/XF/Mail/Mailer.php(276): Swift_Transport_AbstractSmtpTransport->start()
#3 src/XF/Mail/Mail.php(347): XF\Mail\Mailer->send(Object(Swift_Message), NULL)
#4 src/XF/Service/User/AbstractConfirmationService.php(85): XF\Mail\Mail->send()
#5 src/XF/Service/User/AbstractConfirmationService.php(63): XF\Service\User\AbstractConfirmationService->sendConfirmationEmail()
#6 src/XF/Service/User/Registration.php(360): XF\Service\User\AbstractConfirmationService->triggerConfirmation()
#7 src/XF/Service/User/Registration.php(291): XF\Service\User\Registration->sendRegistrationContact()
#8 src/XF/Service/ValidateAndSavableTrait.php(40): XF\Service\User\Registration->_save()
#9 src/XF/Pub/Controller/Register.php(414): XF\Service\User\Registration->save()
#10 src/XF/Mvc/Dispatcher.php(249): XF\Pub\Controller\Register->actionRegister(Object(XF\Mvc\ParameterBag))
#11 src/XF/Mvc/Dispatcher.php(89): XF\Mvc\Dispatcher->dispatchClass('XF:Register', 'register', 'json', Object(XF\Mvc\ParameterBag), '', Object(XF\Pub\Controller\Register), NULL)
#12 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#13 src/XF/App.php(1934): XF\Mvc\Dispatcher->run()
#14 src/XF.php(333): XF\App->run()
#15 index.php(13): XF::runApp('XF\\Pub\\App')
#16 {main}

Request state
PHP:
array(4) {
  ["url"] => string(34) "/forum/index.php?register/register"
  ["referrer"] => string(55) "https://plantconservatory.com/forum/index.php?register/"
  ["_GET"] => array(1) {
    ["register/register"] => string(0) ""
  }
  ["_POST"] => array(14) {
    ["username"] => string(0) ""
    ["e201d8ca623ef81575d1e8f0c06729d207034ae0"] => string(8) "Bluefish"
    ["73ca1f7019d2aab620aaf337b70d97f3f54c4e82"] => string(25) "email@yahoo.com"
    ["email"] => string(0) ""
    ["password"] => string(8) "********"
    ["eb60ce5a02e077cd84c4ad07bdfe3574fb370994"] => string(8) "********"
    ["g-recaptcha-response"] => string(398) "03AO9ZY1Dds82y9LCKOgHON1QSHOf2HU1E_VkuTdWLIXv9tugQD2d-LsUd3n5Qu2IOfEfNrugF6K40FTWapTVuMcXs1VgYp2DooF-LvENrwqcmNRBf5akKEbvXfGYiy8lTVtJWfiucNNUD7qfPydrKQxcffXuxXBHsze53K9O7umld_OJbHcAd5j5hC9cdN7mVbm_cfUmoH43jM8oKHmUK5EDJFjCfrG5BHqevm-wXTslfl7Gj5Gzz0lWqraVaEufGIIZyu5qFdMGzODvHAtMuSSdVf_2j1LQM_izmOqh3-oLlk9oEk9B2zHkyPfg3boOE_PfdxzEeW_8Pnqs-_psPyEdkkmS4EBl9XoRJUByR6hcwbDQTtfH5nB09Ov4N9wr3d7mvQgZy5xnT"
    ["accept"] => string(1) "1"
    ["reg_key"] => string(16) "BK6KUKtl4_mCnh4J"
    ["9bbf73533e7c9e58228eae912dd07997597a6167"] => string(19) "America/Los_Angeles"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(26) "/forum/index.php?register/"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 

What ports does Mailgun support?
Our servers listen on ports 25, 465 (SSL/TLS), 587 (STARTTLS), and 2525​
... reading again - it looks like you should actually be using port 465 for SSL or TLS ... try that instead.
 
OK! I think this is progress. I noticed the mailgun created an outgoing email address that wasn't really created on the subdomain, (postmaster@mail.mydomain.com). I created that email address on the cpanel and used that as the default email address and left the email transport method set to default and tried it with and without -F parameters. I didn't get an error on XF but I did get one on mailgun.

Accepted: postmaster=11184132=myemail=yahoo.com@mail.mydomain.com 'Mail Failure - rejected by local scanning code'
Code:
{
    "tags": [],
    "envelope": {
        "targets": "postmaster+11184132+myemail=yahoo.com@mail.mydomain.com",
        "transport": "smtp",
        "sender": ""
    },
    "storage": {
        "url": "https://se.api.mailgun.net/v3/domains/mail.mydomain/messages/eyJwIjpmYWxzZSwiayI6Ijk4ZjM0OTdhLWY3Y2YtNDdjNi04MTBhLTRmODQ2Y2QxMTQzZCIsInMiOiI0MTRiYWNiNTgxIiwiYyI6InRhbmtiIn0=",
        "key": "eyJwIjpmYWxzZSwiayI6Ijk4ZjM0OTdhLWY3Y2YtNDdjNi04MTBhLTRmODQ2Y2QxMTQzZCIsInMiOiI0MTRiYWNiNTgxIiwiYyI6InRhbmtiIn0="
    },
    "log-level": "info",
    "id": "EoBhoxJaTSObOypAf_ZTMg",
    "campaigns": [],
    "method": "smtp",
    "user-variables": {},
    "flags": {
        "is-authenticated": false
    },
    "recipient-domain": "mail.mydomain.com",
    "timestamp": 1545174761.135181,
    "message": {
        "headers": {
            "to": "postmaster+11184132+myemail=yahoo.com@mail.mydomain.com",
            "message-id": "E1gZOXY-0008qe-68@business29.web-hosting.com",
            "from": "Mail Delivery System <Mailer-Daemon@business29.web-hosting.com>",
            "subject": "Mail failure - rejected by local scanning code"
        },
        "attachments": [],
        "recipients": [
            "postmaster+11184132+myemail=yahoo.com@mail.mydomain.com"
        ],
        "size": 7181
    },
    "recipient": "postmaster+11184132+myemail=yahoo.com@mail.mydomain.com",
    "event": "accepted"
}
 
@Sim, yes edited to hide domain and email details. I just tried sending an email on webmail using postmaster@mail.mydomain.com and when I hit send I get a popup from webmail stating the address is unknown or is not receiving emails. I tried it on two different email addresses. I'm going to contact namecheap/host. ???????
 
"I get a popup from webmail stating the address is unknown or is not receiving emails "

It sounds like webmail is complaining about the address you are sending TO?

Where does the webmail come from? Is that a namecheap thing? How have you configured it?
 
As a side note, last night a Namecheap tech told me you can't use their email and use mailgun MX records. That info wasn't made available to me until after a week of trying to setup mailgun and my email WITH Namecheap support. When I put the MX records back to the default I stopped getting the email popup when trying to use webmail. I have been talking to mailgun techs this morning, I'll let you know if anything changes.

😫👈
 
What ports does Mailgun support?Our servers listen on ports 25, 465 (SSL/TLS), 587 (STARTTLS), and 2525... reading again - it looks like you should actually be using port 465 for SSL or TLS ... try that instead.

Confusing info from mailgun:


Port 465:
IANA has reassigned a new service to this port, and it should no longer be used for SMTP communications.

However, because it was once recognized by IANA as valid, there may be legacy systems that are only capable of using this connection method. As a result, Mailgun supports SSL connections via port 465. Typically, you will use this port only if your application demands it. A quick Google search, and you’ll find many consumer ISP articles that suggest port 465 as the recommended setup. Hopefully, this ends soon! It is not RFC compliant.
 
Top Bottom