MyBB Community Forums

Full Version: SMTP stopped working a lot of times
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am getting a lot of activation emails not sent out. If i test the emailer with a lost password, i get an email immediately. So i know its working, just not all the times

If i check the mail logs i get for the past month or so a lot of errors with only the message as
Quote:The mail server did not understand the DATA command
Where some are account activations, password resets, and subscriptions that failed to send. 
The mailer is set to SMTP and has been for a long time with issue.

Quote:Mail HnadlerConfusedMTP mail
SMTP hostname: smtp.gmail.com
SMTP port: 587
SMTP username:
SMTP password:
SMTP Encryption ModE: TLS
Mail Logging: Log Everything
ID: yes

I am not sure why all of a sudden it would stop working a large amount of the time? I have 79 pages of mail errors with 2 pages in the past year, and 77 pages in the past month. There seems to be that something happened a month ago.

Is there a chance that we topped off the limit to gmail emails per day via subscriptions? How can you check this, and is there a way to reset the subscriptions?
It's possible that GMail are blocking you from sending too many emails. Most SMTP providers have limits in place to prevent the sending of what they think are SPAM messages. I don't believe there is any way to check if you ar ehitting any kind of limit like that though.

You should be able to reset the subscriptions using a couple of SQL queries such as the following:

UPDATE mybb_users SET subscriptionmethod = 0;

This will set the default subscription method to "no notification".

UPDATE mybb_threadsubscriptions SET notification = 0;

This wil lset all existing subscriptions to not receive a notification.

I can't remember off the top of my head whether subscription settings are cached, so you may need to rebuild a cache in the ACP too.
Do you think this might be most likely culprit? Does those that use SMTP gmail have to reset subscription on a regular basis?

Does this just set the default option or does this actually change everyones subscription to no notification?

I also dont see anything in the cache about subscriptions
default_theme	4.11 KB	Rebuild Cache
version	59 bytes	Rebuild Cache
attachtypes	8.09 KB	Rebuild Cache
smilies	11.66 KB	Rebuild Cache
badwords	6 bytes	Rebuild Cache
usergroups	35.62 KB	Rebuild Cache
myprofile	30 bytes	
stats	266 bytes	Rebuild Cache
statistics	256 bytes	Rebuild Cache
forums	33.84 KB	Rebuild Cache
forumpermissions	50.8 KB	Rebuild Cache
moderators	296 bytes	Rebuild Cache
usertitles	2.98 KB	Rebuild Cache
reportedcontent	90 bytes	Rebuild Cache
awaitingactivation	48 bytes	Rebuild Cache
mycode	1,001 bytes	Rebuild Cache
profilefields	5.88 KB	Rebuild Cache
posticons	1.61 KB	Rebuild Cache
spiders	3.27 KB	Rebuild Cache
bannedips	258 bytes	Rebuild Cache
banned	3.23 KB	Rebuild Cache
bannedemails	6 bytes	Rebuild Cache
birthdays	244 bytes	Rebuild Cache
groupleaders	6 bytes	Rebuild Cache
threadprefixes	5.33 KB	Rebuild Cache
forumsdisplay	215 bytes	Rebuild Cache
plugins	2.15 KB	Reload Cache
internal_settings	68 bytes	Reload Cache
version_history	478 bytes	Reload Cache
update_check	1.87 KB	Rebuild Cache
tasks	38 bytes	Rebuild Cache
mostonline	51 bytes	Reload Cache
most_replied_threads	1.79 KB	Rebuild Cache
most_viewed_threads	1.88 KB	Rebuild Cache
mybb_credits	3.61 KB	Reload Cache
pages	456 bytes	
mailqueue	77 bytes	Rebuild Cache
adminnotes	1.16 KB	Reload Cache
shade_plugins	110 bytes	
google_seo_url	6.88 KB	
jb_plugins	6 bytes	
yourcode	3.93 KB	
euantor_plugins	88 bytes	
modnotes	136 bytes	Reload Cache
ougc_plugins	34 bytes	
grouplegend_leaders	35 bytes	
settings	23.09 KB	Reload Cache
(2017-12-09, 04:12 PM)metulburr Wrote: [ -> ]Do you think this might be most likely culprit? Does those that use SMTP gmail have to reset subscription on a regular basis?

Does this just set the default option or does this actually change everyones subscription to no notification?

I also dont see anything in the cache about subscriptions
default_theme	4.11 KB	Rebuild Cache
version	59 bytes	Rebuild Cache
attachtypes	8.09 KB	Rebuild Cache
smilies	11.66 KB	Rebuild Cache
badwords	6 bytes	Rebuild Cache
usergroups	35.62 KB	Rebuild Cache
myprofile	30 bytes	
stats	266 bytes	Rebuild Cache
statistics	256 bytes	Rebuild Cache
forums	33.84 KB	Rebuild Cache
forumpermissions	50.8 KB	Rebuild Cache
moderators	296 bytes	Rebuild Cache
usertitles	2.98 KB	Rebuild Cache
reportedcontent	90 bytes	Rebuild Cache
awaitingactivation	48 bytes	Rebuild Cache
mycode	1,001 bytes	Rebuild Cache
profilefields	5.88 KB	Rebuild Cache
posticons	1.61 KB	Rebuild Cache
spiders	3.27 KB	Rebuild Cache
bannedips	258 bytes	Rebuild Cache
banned	3.23 KB	Rebuild Cache
bannedemails	6 bytes	Rebuild Cache
birthdays	244 bytes	Rebuild Cache
groupleaders	6 bytes	Rebuild Cache
threadprefixes	5.33 KB	Rebuild Cache
forumsdisplay	215 bytes	Rebuild Cache
plugins	2.15 KB	Reload Cache
internal_settings	68 bytes	Reload Cache
version_history	478 bytes	Reload Cache
update_check	1.87 KB	Rebuild Cache
tasks	38 bytes	Rebuild Cache
mostonline	51 bytes	Reload Cache
most_replied_threads	1.79 KB	Rebuild Cache
most_viewed_threads	1.88 KB	Rebuild Cache
mybb_credits	3.61 KB	Reload Cache
pages	456 bytes	
mailqueue	77 bytes	Rebuild Cache
adminnotes	1.16 KB	Reload Cache
shade_plugins	110 bytes	
google_seo_url	6.88 KB	
jb_plugins	6 bytes	
yourcode	3.93 KB	
euantor_plugins	88 bytes	
modnotes	136 bytes	Reload Cache
ougc_plugins	34 bytes	
grouplegend_leaders	35 bytes	
settings	23.09 KB	Reload Cache

It could be. GMail isn't designed for mass sending of emails constantly.

The first query changes the default subscription mode, the second one resets all existing subscriptions.
Quote: GMail isn't designed for mass sending of emails constantly.

OP, nor anyone really, should be using Gmail SMTP for their forums SMTP service. It's free and not designed for commercial use.

Likely you should use PHP mail or consider an actual commercial SMTP provider. They aren't too expensive for smaller forums.
(2017-12-10, 10:31 AM)labrocca Wrote: [ -> ]
Quote: GMail isn't designed for mass sending of emails constantly.

OP, nor anyone really, should be using Gmail SMTP for their forums SMTP service.  It's free and not designed for commercial use.  

Likely you should use PHP mail or consider an actual commercial SMTP provider.  They aren't too expensive for smaller forums.

Exactly. Most smaller forums wouldn't even need to pay anything - services like MailGun are designed for this kind of task and offer 10,000 emails a month for free. Most smaller or even medium sized boards will never hit 10K emails a month.
i tried setting up sendmail/postfix to send out mail but it got quite complicated in getting it to work. I had no help from Ubuntu forums in tweaking the  settings to get it to work, so to get it to initially send mail i used SMTP.

When i started the forum i was thinking in terms of activation emails...which SMTP would be fine. But subscriptions...who knows how many are being sent out then.
Quote:But subscriptions...who knows how many are being sent out then.

I agree that it can be a hassle and I think a suggestion was made for the MyBB team to have a setting for allowing email subscriptions or not.

What problems did you have setting up postfix? Usually server SMTP setup is fairly straightforward.
That would be nice to at least have the option to turn off subscriptions.

I dont remember to be honest. It was over a year ago at this point.  I remember going through a few different tutorials to try to get it to work, settings required ,etc.  I  cant find which ones i used now though and what what the block wall i ended up at.

I think a lot of confusion was at the point that i am only trying to send out activation emails and subscriptions. I could care less about incoming mail, in fact i would send them to null.

I know i did something weird and mixed Gmail SMTP with sendmail or postfix. I think i used sendmail as relay
apt-get install sendmail mailutils sendmail-bin 
mkdir -m 700 /etc/mail/authinfo/
cd /etc/mail/authinfo/
AuthInfo: "U:root" "I:YOUR GMAIL EMAIL ADDRESS" "P:YOUR PASSWORD"
makemap hash gmail-auth < gmail-auth
sendmail.mc
define(`SMART_HOST',`[smtp.gmail.com]')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_OPTIONS', `A p')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo',`hash -o /etc/mail/authinfo/gmail-auth.db')dnl


I know that setting this all up was just a relay to SMTP anyways....but i have no idea what im doing let alone if this is just a relay, setting up sendail or postfix to handle it directly seems way too complicated. And now my sendmail is mixed up with gmail SMTP.

EDIT:
actually im not sure. Because if i do this
$ echo "This is the body of the email" | mail -s "This is the subject line" EMAILADDRESS
i get an email from one of the gmail accounts.

ok lets start at the beginning, reinstalled postfix again, didnt get any prompts so i forced it

metulburr ~ $ sudo dpkg-reconfigure postfix
 * Stopping Postfix Mail Transport Agent postfix                                                  [ OK ] 
setting synchronous mail queue updates: false
changing /etc/mailname to python-forum.io
setting myorigin
setting destinations: 
setting relayhost: 
setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
setting mailbox_command
setting mailbox_size_limit: 0
setting recipient_delimiter: +
setting inet_interfaces: all
setting inet_protocols: all

Postfix is now set up with the changes above.  If you need to make changes, edit
/etc/postfix/main.cf (and others) as needed.  To view Postfix configuration
values, see postconf(1).

After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.

Running newaliases
 * Stopping Postfix Mail Transport Agent postfix                                                  [ OK ] 
 * Starting Postfix Mail Transport Agent postfix                                                  [ OK ] 
Processing triggers for libc-bin (2.19-0ubuntu6.13) ...
metulburr ~ $ sudo postconf -e 'home_mailbox= Maildir/'
metulburr ~ $ sudo postconf -e 'virtual_alias_maps= hash:/etc/postfix/virtual'
metulburr ~ $ sudo vim /etc/postfix/virtual
metulburr ~ $ sudo postmap /etc/postfix/virtual
metulburr ~ $ sudo systemctl restart postfix
sudo: systemctl: command not found
metulburr ~ $ /etc/init.d/postfix reload
 * Reloading Postfix configuration...                                                                    postfix: error: to submit mail, use the Postfix sendmail command
postfix: fatal: the postfix command is reserved for the superuser
                                                                                                  [fail]
metulburr ~ $ sudo !!
sudo /etc/init.d/postfix reload
 * Reloading Postfix configuration...                                                                    postfix/postfix-script: fatal: the Postfix mail system is not running
                                                                                                  [fail]
metulburr ~ $ sudo ufw allow Postfix
Rule added
Rule added (v6)

metulburr ~ $ echo 'export MAIL=~/Maildir' | sudo tee -a /etc/bash.bashrc | sudo tee -a /etc/profile.d/mail.sh
export MAIL=~/Maildir
metulburr ~ $ source /etc/profile.d/mail.sh
metulburr ~ $ sudo apt-get install s-nail
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package s-nail
metulburr ~ $ echo "deb http://in.archive.ubuntu.com/ubuntu/ xenial universe" | sudo tee -a /etc/apt/sources.list
deb http://in.archive.ubuntu.com/ubuntu/ xenial universe
metulburr ~ $ sudo apt-get update

metulburr ~ $ sudo apt-get install s-nail
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 s-nail : Depends: libssl1.0.0 (>= 1.0.2~beta3) but 1.0.1f-1ubuntu2.23 is to be installed
          Depends: libtinfo5 (>= 6) but 5.9+20140118-1ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages.


I am currently having a problem with s-nail. I dont know if i need it or if i can bypass that aspect or not? I am assuming i need it as if i do this
echo 'init' | mail -s 'init' metulburr
it runs, but doesnt create the Maildir structure in my home.