0

I've setup the FQDN in /etc/hosts:

127.0.0.1 hostname.domain hostname
127.0.0.1 localhost
  • however if I run hostname it returns the FQDN?? is something wrong here?

Then ran: sendmailconfig

I've used this to test: echo "Subject: hello" | sendmail -v test@example.com < mail.txt But i can't sucessfully send... It hangs like this:

root@debianxx:~# echo "Subject: hello" | sendmail -v xxxx@gmail.com < email.txt 
xxxx@gmail.com... Connecting to [127.0.0.1] via relay...
220 debianxx.online ESMTP Sendmail 8.15.2/8.15.2/Debian-22; Sat, 19 Nov 2022 07:53:11 GMT; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
>>> EHLO debianxx.online
250-debianxx.online Hello localhost [127.0.0.1], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-EXPN
250-VERB
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-DELIVERBY
250 HELP
>>> VERB
250 2.0.0 Verbose mode
>>> MAIL From:<root@debianxx.online> SIZE=47 AUTH=root@debianxx.online
250 2.1.0 <root@debianxx.online>... Sender ok
>>> RCPT To:<xxxx@gmail.com>
>>> DATA
250 2.1.5 <xxxx@gmail.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .

it hangs at the '.' prompt no matter what I type.

  • ps: I've already checked for the open port with nc -l 25.

Edit sendmail log:

Nov 19 12:21:14 simplysocial sendmail[7718]: alias database /etc/mail/aliases rebuilt by root
Nov 19 12:21:14 simplysocial sendmail[7718]: /etc/mail/aliases: 0 aliases, longest 0 bytes, 0 bytes total
Nov 19 12:21:14 simplysocial sm-mta[7784]: starting daemon (8.15.2): SMTP+queueing@00:10:00
Nov 19 12:21:29 simplysocial sendmail[8460]: alias database /etc/mail/aliases rebuilt by root
Nov 19 12:21:29 simplysocial sendmail[8460]: /etc/mail/aliases: 0 aliases, longest 0 bytes, 0 bytes total
Nov 19 12:21:31 simplysocial sm-mta[7784]: restarting /usr/sbin/sendmail-mta due to signal
Nov 19 12:21:31 simplysocial sm-mta[8510]: starting daemon (8.15.2): SMTP+queueing@00:10:00
Nov 19 12:21:52 simplysocial sendmail[8544]: 2AJCLq0k008544: from=root, size=47, class=0, nrcpts=1, msgid=<202211191221.2AJCLq0k008544@simplysocial.online>, relay=root@localhost
Nov 19 12:21:52 simplysocial sm-mta[8545]: 2AJCLqu9008545: from=<root@simplysocial.online>, size=335, class=0, nrcpts=1, msgid=<202211191221.2AJCLq0k008544@simplysocial.online>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Nov 19 12:21:52 simplysocial sendmail[8544]: 2AJCLq0k008544: to=ntn.ajit@gmail.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30047, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (2AJCLqu9008545 Message accepted for delivery)

Anton A
  • 9
  • 1
  • 6
  • I ran traceroute: ```traceroute -n -T -p 25 gmail-smtp-in.l.google.com traceroute to gmail-smtp-in.l.google.com (173.194.76.26), 30 hops max, 60 byte packets 1 * * * 2 * * * 3 * * * 4 * * * 5 * * * 6 * * * 7 * * * 8 * * * 9 * * * 10 * * * 11 * * * 12 * * * 13 * * * 14 * * * 15 * * * 16 * * * 17 * * * 18 * * * 19 * * * 20 * * * 21 * * * 22 * * * 23 * * * 24 * * * 25 * * * 26 * * * 27 * * * 28 * * * 29 * * * 30 * * *``` what does this imply? – Anton A Nov 19 '22 at 12:04

1 Answers1

0

I've setup the FQDN in /etc/hosts but I run hostname it returns the FQDN? Is something wrong here?

No.

  1. The notion your system has for its hostname is independent of what is, or is not, set in /etc/hosts.
    Your systems hostname is a kernel tunable (see for example sysctl kernel.hostname or cat /proc/sys/kernel/hostname) that is normally set boot time in a distribution specific way (on systemd based hosts you typically configure the system hostname with hostnamectl) and the hostname can be changed at runtime with the hostname some.name command or similar commands such as sysctl kernel.hostname=some.name or hostnamectl set-hostname some.name etc.
    Depending on the method that change is persistent or the the hostname will revert at the next reboot.

  2. Although there are conventions there is nowadays generally no actual (technical) requirement for the hostname some.name to be either a short single label hostname or a FQDN hostname.example.com.. Both are allowed : see for example Setting the hostname: FQDN or short name?

  3. When you set a FQDN as the hostname both the hostname command and the hostname --fqdn command will return a FQDN.


It should be noted that the sendmail command is not intended as a user interface routine and there are much better utilities to send mail from the command line. The classic mail command and mailx for example.

Is sendmail logging an error message in your system logs?

The output Connecting to [127.0.0.1] via relay. suggests that you have configured sendmail with a relay, a "smart host" in sendmail jargon.

Can that relay be reached?

diya
  • 1,771
  • 3
  • 14
  • i've tried postfix and now i get " Connection timed out" error. as per my traceroute; isnt the port 25 being blocked; maybe the nc connection made it thorough ipv6? according to searching around here... – Anton A Nov 19 '22 at 12:15
  • i dont have the sendmail logs but it said something ' message accepted' but never actually delevered – Anton A Nov 19 '22 at 12:16
  • 1
    i've attached the sendmail logs – Anton A Nov 19 '22 at 12:24
  • `Message accepted for delivery` suggests that something went right. Are there more lines? Check the `mailq` command and/or your mailbox contents (common defaults are /var/spool/mail ) – diya Nov 19 '22 at 12:31
  • MSP Queue status... /var/spool/mqueue-client is empty Total requests: 0 MTA Queue status... /var/spool/mqueue (23 requests) -----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient----------- 2AJCLqu9008545* 17 Sat Nov 19 12:21 – Anton A Nov 19 '22 at 12:36
  • there are other connection timed out but those are from postfix attempts. is there a way to avoid the relay mode? thank you for your attention – Anton A Nov 19 '22 at 12:37
  • connection time outs suggest that a remote smtp port, TCP 25 can't be reached. Many consumer ISP as well as hosting providers block outgoing SMTP to port 25 to prevent SPAM and you either need to use their relay service or third part that will let you send mail via their mail service – diya Nov 19 '22 at 14:02
  • i wonder how the nc command connected?? i raise a request with the vps provider and see – Anton A Nov 19 '22 at 14:23