Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect with SMTP #293

Closed
shopglobal opened this issue Aug 3, 2017 · 20 comments
Closed

Can't connect with SMTP #293

shopglobal opened this issue Aug 3, 2017 · 20 comments

Comments

@shopglobal
Copy link

I'm trying to connect with SMTP and I'm not able to use the provided details in the configuration. Please advise, how have you been able to successfully send via SMTP? What's the process?

I've tried the following;

u/user
passKey

postal.mydomain.com
25 or 2525

@shopglobal
Copy link
Author

When I add additional credentials how do I use then?

@shopglobal
Copy link
Author

shopglobal commented Aug 3, 2017

@willpower232 We have sent test messages successfully but not though SMTP

@willpower232
Copy link
Collaborator

You can try using postal status and netstat -lnp to see if you have an SMTP process for postal.

After you have created a credential, a link appears saying Read more about sending outgoing e-mails which tells you how to use the credential. Additional credentials are essentially different passwords for the same username.

@shopglobal
Copy link
Author

shopglobal commented Aug 5, 2017 via email

@willpower232
Copy link
Collaborator

Can you send the output of netstat -lnp from the terminal on your server? You will need to use sudo or be root.

@willpower232
Copy link
Collaborator

It might be worth verifying that the SMTP port is reachable.

Can you try using telnet from your computer to try to connect to your server? telnet postal.yourserver.com 25

P.S. screenshots are better than textual messages

@willpower232
Copy link
Collaborator

Thanks for that, have you had a go with telnet yet?

Can you try using telnet from your computer to try to connect to your server? telnet postal.yourserver.com 25

@shopglobal
Copy link
Author

shopglobal commented Sep 17, 2017 via email

@shopglobal
Copy link
Author

Telnet suggests SMTP is working, and connection is authenticated with the credentials encoded in base64, however to note .. ... .... the SMTP connection between third party delivery platforms is still showing me errors. So when attempting to connect SMTP I am not authenticating from other platforms.

Should the Username and Password be encoded in base64 on the third party delivery platform? Should I be connecting with STARTTLS, or other methods? What is preventing the SMTP from connecting to third party delivery platforms?(seeing as Telnet method is working..)

I am only able to deliver any messages with clicking through messages/send test at postal.mydomain.com/org/v/servers/postal/messages/new
Verified receipt of tests, and all is working. But cannot connect to SMTP with my email delivery platform.. What am I missing?

@shopglobal
Copy link
Author

@willpower232 @adamcooke netstat -lnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 18979/[postal] web.
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 1403/beam.smp
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1800/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1526/nginx -g daemo
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 1550/epmd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1419/sshd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 1526/nginx -g daemo
tcp6 0 0 :::5672 :::* LISTEN 1403/beam.smp
tcp6 0 0 :::80 :::* LISTEN 1526/nginx -g daemo
tcp6 0 0 :::4369 :::* LISTEN 1550/epmd
tcp6 0 0 :::22 :::* LISTEN 1419/sshd
tcp6 0 0 :::25 :::* LISTEN 18959/[postal] smtp
tcp6 0 0 :::443 :::* LISTEN 1526/nginx -g daemo
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node PID/Program name P ath
unix 2 [ ACC ] STREAM LISTENING 7927 1/init / run/systemd/journal/stdout
unix 2 [ ACC ] STREAM LISTENING 25941 4474/systemd / run/user/0/systemd/private
unix 2 [ ACC ] SEQPACKET LISTENING 7923 1/init / run/udev/control
unix 2 [ ACC ] STREAM LISTENING 12429 1/init / run/snapd.socket
unix 2 [ ACC ] STREAM LISTENING 8074 1/init / run/lvm/lvmpolld.socket
unix 2 [ ACC ] STREAM LISTENING 12431 1/init / var/lib/lxd/unix.socket
unix 2 [ ACC ] STREAM LISTENING 12430 1/init / run/snapd-snap.socket
unix 2 [ ACC ] STREAM LISTENING 12432 1/init / run/acpid.socket
unix 2 [ ACC ] STREAM LISTENING 12433 1/init / run/uuidd/request
unix 2 [ ACC ] STREAM LISTENING 12434 1/init / var/run/dbus/system_bus_socket
unix 2 [ ACC ] STREAM LISTENING 16328 1800/mysqld / var/run/mysqld/mysqld.sock
unix 2 [ ACC ] STREAM LISTENING 26248 4618/app) / tmp/postal/pids/procodile.sock
unix 2 [ ACC ] STREAM LISTENING 13767 1366/iscsid @ ISCSIADM_ABSTRACT_NAMESPACE
unix 2 [ ACC ] STREAM LISTENING 7913 1/init / run/systemd/private
unix 2 [ ACC ] STREAM LISTENING 7925 1/init / run/lvm/lvmetad.socket

@willpower232
Copy link
Collaborator

As far as I am aware, you don't need to base64 encode things.

We had some issues with port 25 on AWS so used iptables on our postal server to create a second port to bypass any filtering. Have a go with #212 (comment)

@shopglobal
Copy link
Author

shopglobal commented Oct 3, 2017

I was able to start the SMTP server, and still not able to authenticate with my email platform.

CLIENT: telnet postal.mydomain.com 25
SERVER: Trying //REMOVED POSTAL IPv6 on DO//... Connected to postal.mydomain.com.
SERVER: Escape character is '^]'.
SERVER: 220 postal.mydomain.com ESMTP Postal/NXHLAH
CLIENT: helo
SERVER: 250 postal.mydomain.com
CLIENT: ehlo
SERVER: 250-My capabilities are 250 AUTH CRAM-MD5 PLAIN LOGIN
CLIENT: AUTH LOGIN
SERVER: 334 VXNlcm5hbWU6
//REMOVED BASE64 ENCODED ORGANIZATION/USERNAME STRING//
SERVER: 334 UGFzc3dvcmQ6
//REMOVED BASE64 ENCODED PASSWORD STRING//
SERVER: 235 Granted for //REMOVED ORGANIZATION/USERNAME STRING//
250 OK
MAIL FROM: test@verifiedpostaldomain.com
250 OK
RCPT TO: realaddress@myotherdomain.com
250 OK
DATA
354 Go ahead
Hello,
this is a test. Testing the SMTP on Postal.
.
530 From/Sender name is not valid

@willpower232 @adamcooke Note that "postal status" response does not list port #'s for active processes, if this is any indication of misconfiguration please let me know what to do. I am just not able to authenticate with third party delivery platforms using SMTP method as of yet. I have credentials, and verified telnet ability, but the delivery and authentication from other platforms is just giving me troubles. Hoping this can help

root@postal:/opt/postal/config# postal status
Procodile Version 1.0.17
Application Root /opt/postal/app
Supervisor PID 22850
Started 2017-10-03 21:22:25 +0000

|| web
|| Quantity 1
|| Command bundle exec puma -C config/puma.rb
|| Respawning 5 every 3600 seconds
|| Restart mode usr1
|| Log path none specified
|| Address/Port none
|| => web.1 Running 21:22 pid:22856 respawns:0 port:- tag:-

|| worker
|| Quantity 1
|| Command bundle exec ruby script/worker.rb
|| Respawning 5 every 3600 seconds
|| Restart mode start-term
|| Log path none specified
|| Address/Port none
|| => worker.1 Running 21:22 pid:22858 respawns:0 port:- tag:-

|| cron
|| Quantity 1
|| Command bundle exec rake postal:cron
|| Respawning 5 every 3600 seconds
|| Restart mode term-start
|| Log path none specified
|| Address/Port none
|| => cron.1 Running 21:22 pid:22860 respawns:0 port:- tag:-

|| smtp
|| Quantity 1
|| Command bundle exec rake postal:smtp_server
|| Respawning 5 every 3600 seconds
|| Restart mode usr1
|| Log path none specified
|| Address/Port none
|| => smtp.1 Running 21:22 pid:22862 respawns:0 port:- tag:-

|| requeuer
|| Quantity 1
|| Command bundle exec rake postal:requeuer
|| Respawning 5 every 3600 seconds
|| Restart mode term-start
|| Log path none specified
|| Address/Port none
|| => requeuer.1 Running 21:22 pid:22864 respawns:0 port:- tag:-

root@postal:/opt/postal/config# netstat -lnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 22856/[postal] web.
tcp 0 0 0.0.0.0:25672 0.0.0.0:* LISTEN 11092/beam.smp
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 11697/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 21775/nginx: master
tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 11181/epmd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1469/sshd
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 21775/nginx: master
tcp6 0 0 :::5672 :::* LISTEN 11092/beam.smp
tcp6 0 0 :::80 :::* LISTEN 21775/nginx: master
tcp6 0 0 :::4369 :::* LISTEN 11181/epmd
tcp6 0 0 :::22 :::* LISTEN 1469/sshd
tcp6 0 0 :::25 :::* LISTEN 22862/[postal] smtp
tcp6 0 0 :::443 :::* LISTEN 21775/nginx: master
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 [ ACC ] STREAM LISTENING 1624081 22850/app) /tmp/postal/pids/procodile.sock
unix 2 [ ACC ] STREAM LISTENING 8875 1/init /run/lvm/lvmpolld.socket
unix 2 [ ACC ] STREAM LISTENING 21434 4091/systemd /run/user/0/systemd/private
unix 2 [ ACC ] SEQPACKET LISTENING 8876 1/init /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 13522 1/init /var/lib/lxd/unix.socket
unix 2 [ ACC ] STREAM LISTENING 13526 1/init /var/run/dbus/system_bus_socket
unix 2 [ ACC ] STREAM LISTENING 13527 1/init /run/snapd.socket
unix 2 [ ACC ] STREAM LISTENING 13525 1/init /run/acpid.socket
unix 2 [ ACC ] STREAM LISTENING 13528 1/init /run/snapd-snap.socket
unix 2 [ ACC ] STREAM LISTENING 13529 1/init /run/uuidd/request
unix 2 [ ACC ] STREAM LISTENING 13601 1332/iscsid @ISCSIADM_ABSTRACT_NAMESPACE
unix 2 [ ACC ] STREAM LISTENING 1412292 11697/mysqld /var/run/mysqld/mysqld.sock
unix 2 [ ACC ] STREAM LISTENING 8862 1/init /run/systemd/private
unix 2 [ ACC ] STREAM LISTENING 8866 1/init /run/lvm/lvmetad.socket
unix 2 [ ACC ] STREAM LISTENING 8868 1/init /run/systemd/journal/stdout

(omitted my IP from below, replaced with 127.0.0.1 for this post)
root@postal:/opt/postal/config# nmap 127.0.0.1
Starting Nmap 7.01 ( https://nmap.org ) at 2017-10-03 21:22 UTC
Nmap scan report for 127.0.0.1
Host is up (0.000015s latency).
Not shown: 994 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
80/tcp open http
443/tcp open https
587/tcp open submission
2525/tcp open ms-v-worlds
Nmap done: 1 IP address (1 host up) scanned in 1.75 seconds

@shopglobal
Copy link
Author

127.0.0.1 == my ip

:/opt/postal/config# postal test-app-smtp test@verifiedpostaldomain.com
Message was not delivered successfully to SMTP server.
Error: Net::SMTPFatalError (550 Invalid server token
)

SMTP Host: 127.0.0.1
SMTP Port: 25
SMTP Username: (username from help page)
SMTP Password: (apikey from help page)

@willpower232
Copy link
Collaborator

Postal status wouldn't be intended to show the ports since netstat does a much better job.

In the smtp section of postal.yml try putting the domain name for the host instead of any IP address.

'From/Sender name is not valid' implies that your domain may not be verified for the credential used so you should also check that.

@shopglobal
Copy link
Author

shopglobal commented Oct 4, 2017 via email

@shopglobal
Copy link
Author

@willpower232

@shopglobal
Copy link
Author

Also can't send with API but testing works

@willpower232
Copy link
Collaborator

'From/Sender name is not valid' implies that your domain may not be verified for the credential used so you should also check that.

Make sure you are using a credential that comes from the same area as the domain name you are trying to send with.

@Reklen
Copy link

Reklen commented Jan 15, 2018

Same issue it works with telnet command line but it doesn't work using another third party app such as spree mail setting https://github.com/spree-contrib/spree_mail_settings.
ps: I used credentials generated by postal

@willpower232
Copy link
Collaborator

@Reklen please open a new issue with more details of your error message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants