Problems sending outgoing email Azure Ubuntu 14.04 VM

Hi All

Having a few issues setting up ERPNext outgoing email sending sales invoice using gmail email server… I am thinking this may be due to incoming / outgoing security group setup in azure But Im unsure?

I can confirm gmail is setup to allow less secure apps an that port 25 is open in azure incoming security group.

Communications in ERPNext showing as linked and SENT. However no email is being sent.

ERPNext Setup as below:

EMAIL ACCOUNT: Notifications
SERVICE: Gmail
EMAIL ID: ****@.com
PASSWORD: ******

ENABLE OUTGOING: Yes
SMTP SERVER: smtp.gmail.com
USE TLS: Yes
PORT: 587
DEFAULT OUTGOING: Yes

SCHEDULER ERROR AS BELOW

{
“attachments”: “[]”,
“cc”: [],
“communication_name”: “6588cc2353”,
“lang”: “en”,
“print_format”: “Standard”,
“print_html”: “”,
“recipients”: [
paulhayman@hayora.com
],
“site”: “site1.local”
}
Traceback (innermost last):
File “/home/tractorpartslive/frappe-bench/apps/frappe/frappe/tasks.py”, line 231, in sendmail
recipients=recipients, cc=cc)
File “/home/tractorpartslive/frappe-bench/apps/frappe/frappe/core/doctype/communication/communication.py”, line 176, in _notify
notify(self, printhtml, print_format, attachments, recipients, cc)
File “/home/tractorpartslive/frappe-bench/apps/frappe/frappe/core/doctype/communication/email.py”, line 118, in _notify
prepare_to_notify(doc, print_html, print_format, attachments)
File “/home/tractorpartslive/frappe-bench/apps/frappe/frappe/core/doctype/communication/email.py”, line 208, in prepare_to_notify
print_format=print_format, html=print_html))
File “/home/tractorpartslive/frappe-bench/apps/frappe/frappe/init.py”, line 1048, in attach_print
“fcontent”: get_print(doctype, name, print_format=print_format, style=style, html=html, as_pdf=True)
File “/home/tractorpartslive/frappe-bench/apps/frappe/frappe/init.py”, line 1031, in get_print
return get_pdf(html)
File “/home/tractorpartslive/frappe-bench/apps/frappe/frappe/utils/pdf.py”, line 16, in get_pdf
pdfkit.from_string(html, fname, options=options or {})
File “/home/tractorpartslive/frappe-bench/env/src/pdfkit/pdfkit/api.py”, line 68, in from_string
return r.to_pdf(output_path)
File “/home/tractorpartslive/frappe-bench/env/src/pdfkit/pdfkit/pdfkit.py”, line 140, in to_pdf
raise IOError(‘wkhtmltopdf reported an error:\n’ + stderr.decode(‘utf-8’))
IOError: wkhtmltopdf reported an error:
Exit with code 1 due to network error: HostNotFoundError

Many Thanks

Paul

Hi Guys…

@vjFaLk and co…

This one is pulling my hair out!! any ideas as to why I may not have this operating correctly?

thanks in advance

Paul

Hmm, can you try running:

bench set-url-root [sitename] localhost

hi @vjFaLk

Not sure I’ve down this correctly…is sitename the ip?

tractorpartslive@TRACTORPARTSLIVE:~$ bench set-url-root [13.80.121.67:80] localhost
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 9, in
load_entry_point(‘bench==3.0.0’, ‘console_scripts’, ‘bench’)()
File “/home/tractorpartslive/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python2.7/dist-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/tractorpartslive/bench-repo/bench/commands/utils.py”, line 54, in set_url_root
set_url_root(site, url_root)
File “/home/tractorpartslive/bench-repo/bench/utils.py”, line 330, in set_url_root
update_site_config(site, {“host_name”: url_root}, bench=bench)
File “/home/tractorpartslive/bench-repo/bench/utils.py”, line 310, in update_site_config
put_site_config(site, config, bench=bench)
File “/home/tractorpartslive/bench-repo/bench/utils.py”, line 304, in put_site_config
with open(config_path, ‘w’) as f:
IOError: [Errno 2] No such file or directory: u’./sites/[13.80.121.67:80]/site_config.json’

Many thanks

Paul

No no it’s not your ip, it’s your sitename. Go into your sites folder inside frappe-bench and you might find something like site1.local, that’s your site.

So if suppose your sitename is site1.local your command should look like :

bench set-url-root site1.local localhost

Hi @vjFaLk

OK, this has worked, many thanks, unfortunately the invoice attachment which have sent is now looking rather odd. The print header is not showing on the PDF and the alignment is out.

I also see that the URL to the invoice is not available?

Is there something else I now need to run?

Many Many Thanks

Paul

Hi @vjFaLk I have noticed similar problems with other users on the forum when attempting to email invoice pdf.

I understand we must ass localhost to common_site_config.json file is this correct?

I have added the below but still have the same problem in that when opening attachment in email the pdf is all aligned to the right, my letter header is missing and the URL in the email browser does not open the invoice?

Below is what I have added to common_site_config.json

{
“auto_update”: false,
“background_workers”: 1,
“frappe_user”: “tractorpartslive”,
“gunicorn_workers”: 1,
“host_name”:“http://13.80.121.67:80”,
“rebase_on_pull”: false,
“redis_cache”: “redis://localhost:13000”,
“redis_queue”: “redis://localhost:11000”,
“redis_socketio”: “redis://localhost:12000”,
“restart_supervisor_on_update”: true,
“serve_default_site”: true,
“shallow_clone”: true,
“socketio_port”: 9000,
“update_bench_on_update”: true,
“webserver_port”: 8000
}
common_site_config.json (END)

hi all…

Is anybody able to shed any light on this please? Pdf Print view on invoice prior to sending email

after sending email the recipient views invoice as below? do we know what needs to be updated to ensure the same pdf attachment is visible to clients receiving the email?

Many Thannks

Paul