Simple Machines Community Forum

SMF Support => Server Performance and Configuration => Topic started by: deery50 on June 14, 2013, 06:10:00 PM

Title: Activation Emails not sent
Post by: deery50 on June 14, 2013, 06:10:00 PM
Hello, I have my own hosted forum at home. When a user registers He/she does not receive the activation email. I am really confused about the whole php email buisness so can someone explain to me how I can fix this, thanks! Here is what I have under php.ini after searching the internet for help:

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = [email protected]

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = On

; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =
Title: Re: Activation Emails not sent
Post by: eutychus on June 14, 2013, 07:56:47 PM
Are you sure it's a php issue? I had the same problem and it turned out that my email settings were wrong.

Check under Admin > Maintenance > Mail > Settings
Title: Re: Activation Emails not sent
Post by: 青山 素子 on June 15, 2013, 03:42:34 AM
Tell us about your server. What OS? How is SMF configured to send e-mail right now?
Title: Re: Activation Emails not sent
Post by: deery50 on June 15, 2013, 04:19:40 PM
Quote from: 青山 素子 on June 15, 2013, 03:42:34 AM
Tell us about your server. What OS? How is SMF configured to send e-mail right now?

Running on Ubuntuserver with Apache, Right now it is set to (php default). Thanks for the responses!
Title: Re: Activation Emails not sent
Post by: 青山 素子 on June 16, 2013, 03:26:17 AM
Check /var/log/maillog and see what things say. If you have a residential connection, it's almost certain port 25 outbound is blocked. In that case, you'll need to relay mail out to another system.
Title: Re: Activation Emails not sent
Post by: deery50 on June 16, 2013, 01:58:35 PM
Quote from: 青山 素子 on June 16, 2013, 03:26:17 AM
Check /var/log/maillog and see what things say. If you have a residential connection, it's almost certain port 25 outbound is blocked. In that case, you'll need to relay mail out to another system.
mail.log seems to not exist. Huh... weird
Title: Re: Activation Emails not sent
Post by: deery50 on June 16, 2013, 08:05:51 PM
Edit: How stupid am I...I do have a mail.log (I was in a rush when I checked) I noted these lines in the log:

Jun 16 19:46:09 Runetooncraft postfix/qmgr[1333]: 96EB5120078D: from=<[email protected]>, size=1789, nrcpt=1 (queue active)
Jun 16 19:46:09 Runetooncraft postfix/qmgr[1333]: E09E31200780: from=<[email protected]>, size=1789, nrcpt=1 (queue active)
Jun 16 19:46:09 Runetooncraft postfix/qmgr[1333]: 700CE120078B: from=<[email protected]>, size=1781, nrcpt=1 (queue active)
Jun 16 19:46:09 Runetooncraft postfix/smtp[3335]: 96EB5120078D: to=<**********@gmail.com>, relay=none, delay=21182, delays=21182/0.09/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=gmail.com type=MX: Host not found, try again)
Jun 16 19:46:10 Runetooncraft postfix/smtp[3338]: 700CE120078B: to=<**********@gmail.com>, relay=none, delay=21379, delays=21379/0.06/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=gmail.com type=MX: Host not found, try again)
Jun 16 19:46:10 Runetooncraft postfix/smtp[3336]: E09E31200780: to=<**********@gmail.com>, relay=none, delay=21149, delays=21149/0.07/0/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=gmail.com type=MX: Host not found, try again)

This must of been when the activation email was trying to send to one of my users. I blocked his username in the code.

Here is a larger section of mail.log (with the blocked username still): http://pastebin.com/8JP9g9vV
Title: Re: Activation Emails not sent
Post by: deery50 on June 17, 2013, 11:06:31 AM
This is still a big issue

Jun 17 11:04:08 Runetooncraft postfix/qmgr[1599]: 4B9031200B87: from=<[email protected]>, size=1787, nrcpt=1 (queue active)
Jun 17 11:04:38 Runetooncraft postfix/smtp[4633]: connect to gmail-smtp-in.l.google.com[173.194.74.26]:25: Connection timed out
Jun 17 11:04:38 Runetooncraft postfix/smtp[4633]: connect to gmail-smtp-in.l.google.com[2607:f8b0:400d:c00::1a]:25: Network is unreachable
Jun 17 11:04:38 Runetooncraft postfix/smtp[4633]: connect to alt1.gmail-smtp-in.l.google.com[2a00:1450:400c:c03::1b]:25: Network is unreachable
Jun 17 11:05:08 Runetooncraft postfix/smtp[4633]: connect to alt1.gmail-smtp-in.l.google.com[173.194.67.27]:25: Connection timed out
Jun 17 11:05:08 Runetooncraft postfix/smtp[4633]: connect to alt2.gmail-smtp-in.l.google.com[2a00:1450:4013:c00::1b]:25: Network is unreachable
Jun 17 11:05:08 Runetooncraft postfix/smtp[4633]: 4B9031200B87: to=<*******@gmail.com>, relay=none, delay=60, delays=0.11/0.01/60/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[2a00:1450:4013:c00::1b]:25: Network is unreachable)
Title: Re: Activation Emails not sent
Post by: 青山 素子 on June 17, 2013, 04:02:52 PM
Your internet provider is blocking outbound connections on port 25. If you have a business-class connection, you can usually call them and get the block lifted. You'll also need to get proper rDNS entries and make sure you have a static IP if you don't want mail rejected. If you're on a residential-class connection you're likely breaking the TOS by running a server at all, so I wouldn't call them unless you want to get your account canceled.

If the block will not be lifted or you're on a residential connection, you'll need to configure mail to relay out through a proper server. You can do this at the SMF level, or through Postfix (the mail service running on your system). If you're not going to have other software on the system, it's easier to configure with SMF. If you're going to set up a whole bunch of products, it's simpler to make the change in the Postfix configuration.

For the SMF side, you can configure the e-mail method in the SMF settings. A popular outbound relay is Google's gmail. You can use this guide (http://www.simplemachines.org/index.php?topic=343385.0) as a reference for how to set it up.

If you want to configure Postfix, you can use this guide (http://www.dnsexit.com/support/mailrelay/postfix.html) as a reference for how to set it up.
Title: Re: Activation Emails not sent
Post by: deery50 on June 17, 2013, 07:20:55 PM
Quote from: 青山 素子 on June 17, 2013, 04:02:52 PM
Your internet provider is blocking outbound connections on port 25. If you have a business-class connection, you can usually call them and get the block lifted. You'll also need to get proper rDNS entries and make sure you have a static IP if you don't want mail rejected. If you're on a residential-class connection you're likely breaking the TOS by running a server at all, so I wouldn't call them unless you want to get your account canceled.

If the block will not be lifted or you're on a residential connection, you'll need to configure mail to relay out through a proper server. You can do this at the SMF level, or through Postfix (the mail service running on your system). If you're not going to have other software on the system, it's easier to configure with SMF. If you're going to set up a whole bunch of products, it's simpler to make the change in the Postfix configuration.

For the SMF side, you can configure the e-mail method in the SMF settings. A popular outbound relay is Google's gmail. You can use this guide (http://www.simplemachines.org/index.php?topic=343385.0) as a reference for how to set it up.

If you want to configure Postfix, you can use this guide (http://www.dnsexit.com/support/mailrelay/postfix.html) as a reference for how to set it up.

Godaddy (my domain provider) has actually given me a free email that I am using, it has a SMTP option. Would I be able to get  postfix to connect to this SMTP server instead, like documented here: http://www.redwireservices.com/postfix-smtp-relay-via-godaddy-alternate-port-and-others (http://www.redwireservices.com/postfix-smtp-relay-via-godaddy-alternate-port-and-others), or will it still be blocked?
Title: Re: Activation Emails not sent
Post by: 青山 素子 on June 18, 2013, 01:51:47 AM
You can configure SMF or Postfix for any e-mail service you like. Use the guides I linked, but substitute the information for your service.