Https and http Email


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


But all not work

so i tested and creat another site in the same bench

its name

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 languages.txt

i need your guide dears
thank u

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: 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
and i restore all the data from erpnext.vm TO
then i create a certficate using lestencrypt for that domain
and the site work well with all its old data that i restore from my old
Except the Email
even i attempted to remove mail and add a new mail
gmail or hotmail or even my commercial mail
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


1 Like

Actually the SMTP port is working well because the http ( site is working well
while the https site ( not

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

frappe@erpnext:~$ sudo netstat -tulpn | grep LISTEN
tcp 0 0* LISTEN 1096/sshd
tcp 0 0* LISTEN 2074/redis-server 1
tcp 0 0* LISTEN 1950/master
tcp 0 0* LISTEN 2873/0
tcp 0 0* LISTEN 3146/2
tcp 0 0* LISTEN 1822/nginx
tcp 0 0* LISTEN 2067/python
tcp 0 0* LISTEN 2076/redis-server 1
tcp 0 0* LISTEN 2072/nodejs
tcp 0 0* LISTEN 2075/redis-server 1
tcp 0 0* LISTEN 1682/mysqld
tcp 0 0* LISTEN 1970/redis-server 1
tcp 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

Thats exactly what i was think but lets check together

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

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

“db_name”: “",
“db_password”: "
“encryption_key”: “",
“ssl_certificate”: “/etc/letsencrypt/live/”,
“ssl_certificate_key”: “/etc/letsencrypt/live/”,
“dropbox_access_key”: "
“dropbox_secret_key”: “**********”,
“developer_mode”: 1,
“host_name”: “



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 587
Connection to 587 port [tcp/submission] succeeded!
220 ESMTP l22sm30607654pfi.2 - gsmtp

frappe@erpnext:~/frappe-bench$ nc -vv 993
Connection to 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.


frappe@erpnext:~$ nc -vv 25
Connection to 25 port [tcp/smtp] succeeded!
220 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 (http site
the problem in 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

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 (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
** (**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 25
Connection to 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