playSMS Forum

Mail2SMS is not fetching emails

Good day! I am trying to configure mail2sms but it not working. The email is not fetched using imap.

Environment:
Ubuntu 18.04
Playsms 1.4.3
PHP7.2
PHP7.2-imap
Logstate = 3

From Gmail

  1. I tried to enable less secure apps but still the same issue.
  2. I generated an app password and used it for playsms but still the same issue.

Configuration

Log does not show anything related to mail.
172.22.0.14 192.168.168.208 2021-02-17 13:01:44 PID602ca338c06f9 admin L2 mailsms # enabled server:imap.gmail.com
172.22.0.14 192.168.168.208 2021-02-17 13:02:31 PID602ca367b0f8c admin L2 mailsms # enabled server:imap.gmail.com
172.22.0.14 192.168.168.208 2021-02-17 13:03:04 PID602ca3883747a admin L2 mailsms # enabled server:imap.gmail.com
172.22.0.14 192.168.168.208 2021-02-17 13:03:17 PID602ca395900c6 admin L2 mailsms # enabled server:imap.gmail.com
172.22.0.14 192.168.168.208 2021-02-17 13:05:44 PID602ca427e46d0 admin L2 mailsms # enabled server:imap.gmail.com
172.22.0.14 192.168.168.208 2021-02-17 13:08:44 PID602ca4dc6b8fe admin L2 mailsms_user # enabled uid:1 u:admin
172.22.0.14 192.168.168.208 2021-02-17 13:09:51 PID602ca51f6a62e admin L2 mailsms_user # enabled uid:1 u:admin
172.22.0.14 192.168.168.208 2021-02-17 13:10:04 PID602ca52c8864f admin L2 logout # u:admin uid:1 status:2 sid:a05ppgjjl198bpui5ut6j7hm0d ip:172.22.0.14
172.22.0.14 192.168.168.208 2021-02-17 13:10:08 PID602ca530806fe - L3 auth_validate_login # login attempt u:ryan uid:4 p:72f4b66594f0e7d295da737f66b3f075 ip:172.22.0.14
172.22.0.14 192.168.168.208 2021-02-17 13:10:08 PID602ca530806fe - L2 auth_validate_login # valid login u:ryan uid:4 ip:172.22.0.14
172.22.0.14 192.168.168.208 2021-02-17 13:10:08 PID602ca530806fe - L2 login # u:ryan uid:4 status:4 sid:a05ppgjjl198bpui5ut6j7hm0d ip:172.22.0.14
172.22.0.14 192.168.168.208 2021-02-17 13:10:13 PID602ca535586de ryan L2 mailsms_user # enabled uid:4 u:ryan
172.22.0.14 192.168.168.208 2021-02-17 13:14:29 PID602ca63585d80 ryan L2 logout # u:ryan uid:4 status:4 sid:a05ppgjjl198bpui5ut6j7hm0d ip:172.22.0.14
172.22.0.14 192.168.168.208 2021-02-17 13:14:39 PID602ca63f9c6e6 - L3 auth_validate_login # login attempt u:admin uid:1 p:21232f297a57a5a743894a0e4a801fc3 ip:172.22.0.14
172.22.0.14 192.168.168.208 2021-02-17 13:14:39 PID602ca63f9c6e6 - L2 auth_validate_login # valid login u:admin uid:1 ip:172.22.0.14
172.22.0.14 192.168.168.208 2021-02-17 13:14:39 PID602ca63f9c6e6 - L2 login # u:admin uid:1 status:2 sid:a05ppgjjl198bpui5ut6j7hm0d ip:172.22.0.14
172.22.0.14 192.168.168.208 2021-02-17 13:14:47 PID602ca6477f9fe admin L2 mailsms # enabled server:imap.gmail.com

This is the email email format I used:
To: smsclient@domain.com
Subject: ryan 1234 Test
Body: 63xxxxxxxxxxx

Did I miss anything? Appreciate your advise on this matter. Thank you!

Hi,

Just tested this and partially worked.

  1. Enable 2FA and add App password (shown with space, but paste in playSMS no space)
  2. Less secure set to OFF
  3. From gmail settings, enable IMAP

playSMS is like your screenshot, but Check email sender is set to no.

After that, I enable My Account -> My email to SMS and set the PIN.

And then, I sent email from another account for test like yours:
To: my email2sms gmail address
Subject: playsmsusername thepin SMS_content_here
Body: destination_number

By partially worked, the body needs to be quoted_printable_decode(), so I made these changes:

Change 1 to 1.1 and add quoted_printable_decode():

UPDATE:
no changes at all if you send from another Gmail, need more googling to handle email body :slight_smile:

And also I use playSMS 1.4.4 master version, but should be about the same for mailsms on 1.4.3

anton

Hi Anton,

Appreciate your response on this. I have 2 servers, 1 on premise (my UAT system) and 1 in Digitalocean (for production implementation). I have done as advised on both servers but I still don’t see anything from the log that shows the email is being fetched from Gmail via IMAP.

Below are the steps I did:

  1. Added the quoted_printable_decode to fn.php
  2. Restart server
  3. Logged in as admin.
  4. Re enter the password under Settings > Manage email to sms. Save the config.
  5. Save and enable mail2sms from My Account > My email to sms. Logged out.
  6. Logged in as user (ryan) and enabled mail2sms from My Account > My email to sms. Logged out.

Sent 2 emails using the email address of user (ryan).
1st email (ryan):
To: smsclient@domain.com
Subject: ryan 1234 TESTEMAIL2SMS
Body: 63xxxxxxxxx

2nd email (admin):
To: smsclient@domain.com
Subject: admin 1234 TESTEMAIL2SMS
Body: 63xxxxxxxxx

Log:
172.22.0.18 192.168.168.208 2021-02-18 09:48:54 PID602dc78664aaf - L2 auth_validate_login # valid login u:ryan uid:4 ip:172.22.0.18
172.22.0.18 192.168.168.208 2021-02-18 09:48:54 PID602dc78664aaf - L2 login # u:ryan uid:4 status:4 sid:isastbofrabt74g6ef4bbse160 ip:172.22.0.18
172.22.0.18 192.168.168.208 2021-02-18 09:53:19 PID602dc88fc0f8b ryan L2 logout # u:ryan uid:4 status:4 sid:isastbofrabt74g6ef4bbse160 ip:172.22.0.18
172.22.0.18 192.168.168.208 2021-02-18 09:53:33 PID602dc89dd6705 - L3 auth_validate_login # login attempt u:admin uid:1 p:73acd9a5972130b75066c82595a1fae3 ip:172.22.0.18
172.22.0.18 192.168.168.208 2021-02-18 09:53:33 PID602dc89dd6705 - L2 auth_validate_login # invalid login u:admin uid:1 ip:172.22.0.18
172.22.0.18 192.168.168.208 2021-02-18 09:53:40 PID602dc8a4680d8 - L3 auth_validate_login # login attempt u:admin uid:1 p:73acd9a5972130b75066c82595a1fae3 ip:172.22.0.18
172.22.0.18 192.168.168.208 2021-02-18 09:53:40 PID602dc8a4680d8 - L2 auth_validate_login # invalid login u:admin uid:1 ip:172.22.0.18
172.22.0.18 192.168.168.208 2021-02-18 09:53:47 PID602dc8ab6167f - L3 auth_validate_login # login attempt u:admin uid:1 p:21232f297a57a5a743894a0e4a801fc3 ip:172.22.0.18
172.22.0.18 192.168.168.208 2021-02-18 09:53:47 PID602dc8ab6167f - L2 auth_validate_login # valid login u:admin uid:1 ip:172.22.0.18
172.22.0.18 192.168.168.208 2021-02-18 09:53:47 PID602dc8ab6167f - L2 login # u:admin uid:1 status:2 sid:isastbofrabt74g6ef4bbse160 ip:172.22.0.18
172.22.0.18 192.168.168.208 2021-02-18 09:56:56 PID602dc96878cf7 admin L2 mailsms # enabled server:imap.gmail.com
172.22.0.18 192.168.168.208 2021-02-18 09:57:13 PID602dc979ac5c2 admin L2 mailsms_user # enabled uid:1 u:admin