Https and http Email

Dears

After i made my site as a secure site with letsencrypt certficate
erp.fastgrp.net
the site work well
But
i cant send any email
i follow all the instruction in this post

_https://discuss.frappe.io/t/email-and-https/23368/7_

But all not work

so i tested and creat another site in the same bench

its name

vmail.fastgrp.net

its HTTP site to see if the email will work
the email work noramlly in HTTP site
while the HTTPS not work

frappe@erpnext:~/frappe-bench/sites$ ls
apps.txt assets common_site_config.json currentsite.txt currentsite.txt.old erp.fastgrp.net languages.txt vmail.fastgrp.net
frappe@erpnext:~/frappe-bench/sites$

i need your guide dears
thank u

https://github.com/frappe/erpnext/issues/8743

I think we need a bit more info. Which version of ERPNext are you running?, Is it on your own VPS? How are you connecting to email? I have a https site with an Lets Encrypt cert and my email is fine. The two aren’t really linked.

1 Like

ok dear

1- ERpnext version

Open Source Applications for the Web Website: https://frappe.io Source: Frappe · GitHub Installed Apps ERPNext: v7.2.1
ERPNext Shopify: v2.0.3
Frappe Framework: v7.2pt.1

2- its a virtual machine with real public ip
3- email setting : was working fine before converting my site to https
4- i got the certficate week a go via letsencrypt

5 - the only thing may be it made the trouble is
my site name was erpnext.vm
so to make it work with a certficate
i creat a new site its name
erp.fastgrp.net
and i restore all the data from erpnext.vm TO erp.fastgrp.net
then i create a certficate using lestencrypt for that domain erp.fastgrp.net
and the site work well with all its old data that i restore from my old
erpnext.vm
Except the Email
even i attempted to remove mail and add a new mail
gmail or hotmail or even my commercial mail info@fastgrp.net
Any of them cant send mails

Hi, can you make sure that the ports required for SMTP are open in your VM?

1 Like

There’s a number of places you need to change your host name from erpnext.vm

In the frappe sites folder
In the site json file imost needs to be added or corrected to your host

There may be another place.

Otherwise your host name that erpnext thinks it’s using is different to
what it is using and may cause ssl errors I would guess

Julian

1 Like

Actually the SMTP port is working well because the http (vmail.fastgrp.net) site is working well
while the https site (erp.fastgrp.net)is not

frappe@erpnext:~/frappe-bench/sites$ ls
apps.txt assets common_site_config.json currentsite.txt currentsite.txt.old erp.fastgrp.net languages.txt vmail.fastgrp.net
frappe@erpnext:~/frappe-bench/sites$

frappe@erpnext:~$ sudo netstat -tulpn | grep LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1096/sshd
tcp 0 0 127.0.0.1:11000 0.0.0.0:* LISTEN 2074/redis-server 1
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 1950/master
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 2873/0
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN 3146/2
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 1822/nginx
tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN 2067/python
tcp 0 0 127.0.0.1:12000 0.0.0.0:* LISTEN 2076/redis-server 1
tcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 2072/nodejs
tcp 0 0 127.0.0.1:13000 0.0.0.0:* LISTEN 2075/redis-server 1
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1682/mysqld
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 1970/redis-server 1
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1822/nginx
tcp6 0 0 :::22 :::* LISTEN 1096/sshd
tcp6 0 0 :::25 :::* LISTEN 1950/master
tcp6 0 0 ::1:6010 :::* LISTEN 2873/0
tcp6 0 0 ::1:6011 :::* LISTEN 3146/2
frappe@erpnext:~$

Thats exactly what i was think but lets check together

frappe@erpnext:~/frappe-bench/sites$ cat currentsite.txt

erp.fastgrp.net

frappe@erpnext:~/frappe-bench/sites/erp.fastgrp.net$ ls
error-snapshots locks private public site_config.json task-logs

{
“db_name”: “",
“db_password”: "
”,
“encryption_key”: “",
“ssl_certificate”: “/etc/letsencrypt/live/erp.fastgrp.net/fullchain.pem”,
“ssl_certificate_key”: “/etc/letsencrypt/live/erp.fastgrp.net/privkey.pem”,
“dropbox_access_key”: "
”,
“dropbox_secret_key”: “**********”,
“developer_mode”: 1,
“host_name”: “https://erp.fastgrp.net”

}

===================

Is there any other places to change ?

To troubleshoot http, https, smtp, pop3, imap etc service connectivity, first identify the port that the tcp service runs, then confirm that the port is open. So for example

frappe@erpnext:~/frappe-bench$ nc -vv smtp.gmail.com 587
Connection to smtp.gmail.com 587 port [tcp/submission] succeeded!
220 smtp.gmail.com ESMTP l22sm30607654pfi.2 - gsmtp

frappe@erpnext:~/frappe-bench$ nc -vv imap.gmail.com 993
Connection to imap.gmail.com 993 port [tcp/imaps] succeeded!

As @Sagar_Vora advised, the required port between the vm guest and host may be closed

In a VM environment, my experience is that bridged is easier than NAT to solve for network connectivity.

2 Likes

frappe@erpnext:~$ nc -vv fastgrp.net 25
Connection to fastgrp.net 25 port [tcp/smtp] succeeded!
220 mail.fastgrp.net ESMTP MailEnable Service, Version: 9.16-- ready at 05/09/17 14:17:53

in addidtion the mail is successfully work if i send from vmail.fastgrp.com (http site
)
while
the problem in erp.fastgrp.net site (https) i cant send any mail

i dont think the problem is https, are u trying to send email using ssl protocol?

1 Like

No
i am sending the email using port 25
without any ssl

Ok, so why you think the problem is https?

1 Like

Because this happend after
i transfer data from

erpnext.vm (http site) To erp.fastgrp.net (the https site)

well …https is not related to smtp email relay …double check your settings

1 Like

its one week now i am trying to figure out the reason that prevent me from sending mail from that https site
while it works well in
**vmail.fastgrp.net (**http site)
with the same mail setting

well for sure it’s not a problem of https …what i can suggest is to double check logs and email settings

1 Like

can u guide me please
How to check the mail log?
where i can find or read it ?

This works as expected

frappe@erpnext:~/frappe-bench$ nc -vv erp.fastgrp.net 25
Connection to erp.fastgrp.net 25 port [tcp/smtp] succeeded!
220 erpnext ESMTP Postfix (Ubuntu)

So now check whether port 25 is open on you VM host and finally from within your VM…

have a look at logs inside frappe-bench/logs/ folder