2

im trying to use mutt to send an email with one attachment, and i keep getting the error could not connect to smtp.gmail.com (Network is unreachable). one thing to note is that one week ago i tried to send email with the exact settings on my muttrc file and it worked fine. Im on debian 9.

my ~/.muttrc setting are

set realname = "my name"

set from = "user@gmail.com"
set use_from = yes
set envelope_from = yes

set smtp_url = "smtps:// user@gmail.com@smtp.gmail.com:465/"
set smtp_pass = "mypassword"
set imap_user = "user@gmail.com"
set imap_pass = "mypassword"
set folder = "imaps://imap.gmail.com:933"
set spoolfile = "+INBOX"
set ssl_starttls = yes
set ssl_force_tls = yes

bind index G imap-getch-mail
set editor = "vim"
set charset = "utf-8"
set record = ''

also i read online that google sometimes becomes unreachable or something like that, if that were the case i would like someone to tell me how can i tell when this is the case

Letho123
  • 99
  • 1
  • 2
  • 9

2 Answers2

3

To investigate this:

First check if the remote host is reachable with ping:

$ ping smtp.gmail.com
PING gmail-smtp-msa.l.google.com (108.177.15.109) 56(84) bytes of data.
64 bytes from wr-in-f109.1e100.net (108.177.15.109): icmp_seq=1 ttl=35 time=39.6 ms

Ok.

Then check if it can be reached on port 465 :

$ telnet smtp.gmail.com 465
Trying 108.177.15.109...
(no response)

There a several possible reasons why port 465 cannot be reached:

  • a firewall prevents port 465 from going through
  • the port number is incorrect
user803422
  • 2,636
  • 2
  • 18
  • 36
  • i´ve done both these steps, i get a normal response from the ping but i get no response when i try to telnet port 465 or port 587. What is confusing me is that 1 week ago this ran fine and im pretty sure that nothing in my network changed.Do you have any tips of things i could try to find a resolution – Letho123 May 21 '19 at 13:11
  • ok ive looked around and i think that something happened with the ports that my pc has open, how would i open port 465 ,587 and 993 – Letho123 May 21 '19 at 13:32
1

I had a similar issue when working on Zammad Helpdesk and Ticketing System.

The issue was that I had a security policy on my server on Amazon Web Services that blocked/refused the Application to send requests to ports that are not allowed on the server.

So since ports 993 for imap.gmail.com, 995 for pop.gmail.com and 465 or 587 for smtp.gmail.com are not allowed on by the security policy on the server, connections to them will not be permitted, which led to the issue:

Host not reachable!

I resolved it by simply opening the ports/allowing connections requests to those ports on the server's security policy.

That's all.

I hope this helps.

Promise Preston
  • 24,334
  • 12
  • 145
  • 143