Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED][Sendmail] Can't send mail to root@localhost
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
kgdrenefort
Guru
Guru


Joined: 19 Sep 2023
Posts: 312
Location: Somewhere in the 77

PostPosted: Sat Sep 28, 2024 10:26 am    Post subject: [SOLVED][Sendmail] Can't send mail to root@localhost Reply with quote

Hello,

For my project I need to be able to send locally an e-mail to root@localhost, or any Unix users I want.

It's on a Raspberry Pi 4 with Gentoo installed on it by the way.

Things to note: I had to install sendmail by adding this file: /etc/portage/package.accept_keyword/sendmail

Code:
<mail-mta/sendmail-9999 **
mail-filter/procmail ~arm64


Allowing me to install it, since there is no ARM64 ebuild.

Now it's installed.

I tried several things to run sendmail, but the best I could get for now is these mails kept in /var/spool/clientmqueue, I can see my previous tests :

Code:
localhost /var/spool # grep -rin "toto" *
clientmqueue/qf48RAxi2O1000483:22:H??sujet: toto
clientmqueue/qf48RB7jsO1000513:22:H??sujet: toto
clientmqueue/qf48SAC9O71013185:22:H??Subject: toto
clientmqueue/qf48SAI3Nm1013236:22:H??Subject: toto_1


Or other, here:

Code:
clientmqueue:
df48RAxi2O1000483  df48RB17Vu1000487  df48RB7jsO1000513  df48SAC9O71013185  qf48RB0bWM1000486  qf48RB4EAW1000504  qf48RBAeuX1000525
df48RB0bWM1000486  df48RB4EAW1000504  df48RBAeuX1000525  qf48RAxi2O1000483  qf48RB17Vu1000487  qf48RB7jsO1000513  qf48SAC9O71013185


Showing me, at least, it try.

I tried to send these by running this kind of command:

Testing if it could works, as root:
Code:
sendmail -bv
root@localhost... deliverable: mailer local, user root


Code:
echo "Subject: toto" | sendmail root@localhost


Etc.

So far, the best I get is to have these stuck in clientmqueue.

Later, I would need to be able to use sendmail with -t -i option from a php.ini file to finalize my PHP form script project, that would later use the proper ways to send e-mail across the network.

Any ideas or suggestion regarding this ?

Regards,
GASPARD DE RENEFORT Kévin
_________________
Traduction wiki, pour praticiper.
Custom logos/biz card/website.


Last edited by kgdrenefort on Fri Oct 04, 2024 12:15 pm; edited 1 time in total
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3415

PostPosted: Sat Sep 28, 2024 1:36 pm    Post subject: Reply with quote

I don't use sendmail, but can you send mail to root without domain? Domain name is not required for local delivery.

/etc/aliases might be worth inspecting, there is no need to alter the default on most systems, but perhaps you'll get some hint from checking it out,
Also, how committed are you to sendmail? Asking just in case.
_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
kgdrenefort
Guru
Guru


Joined: 19 Sep 2023
Posts: 312
Location: Somewhere in the 77

PostPosted: Sat Sep 28, 2024 1:46 pm    Post subject: Reply with quote

szatox wrote:
I don't use sendmail, but can you send mail to root without domain? Domain name is not required for local delivery.

/etc/aliases might be worth inspecting, there is no need to alter the default on most systems, but perhaps you'll get some hint from checking it out,
Also, how committed are you to sendmail? Asking just in case.


Thank for your answer, as the idea. Sadly it doesn't seems to help:

Code:
localhost /var/spool # grep -rin "toto3" *
clientmqueue/qf48SDfQS81013778:22:H??Subject: toto3


While sending as this:

(non-root user)
Code:
echo "Subject: toto3" | sendmail root


(as in root)
Code:
localhost /var/spool # echo "Subject: toto3" | sendmail root
localhost /var/spool # grep -rin "toto3" *
clientmqueue/qf48SDfQS81013778:22:H??Subject: toto3
clientmqueue/qf48SDhm0G1013782:22:H??Subject: toto3


About if I'm committed to sendmail: No, but it seems to be a simple and default way to do so, in my futur project it'll probably rely on a real SMTP server from an ESP I use.

Regards,
GASPARD DE RENEFORT Kévin
_________________
Traduction wiki, pour praticiper.
Custom logos/biz card/website.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3415

PostPosted: Sat Sep 28, 2024 2:46 pm    Post subject: Reply with quote

Well, sendmail certainly is quite old and established. This said, postfix too has matured a long time ago, and does the job pretty well. Local delivery should just work with default config.
You might give it a shot and see which one do you like more.

Either way, have you tried sending mail manually using e.g. netcat or telnet? Server might flat out tell you what's wrong during SMTP conversation.
What about logs? Is it trying to forward your local mail somewhere else? Does it need another MDA to finish the job?
Is a local delivery method defined in sendmail's config?
Are you able to send mail to other, remote servers?
_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
kgdrenefort
Guru
Guru


Joined: 19 Sep 2023
Posts: 312
Location: Somewhere in the 77

PostPosted: Mon Sep 30, 2024 8:16 am    Post subject: Reply with quote

szatox wrote:
Well, sendmail certainly is quite old and established. This said, postfix too has matured a long time ago, and does the job pretty well. Local delivery should just work with default config.
You might give it a shot and see which one do you like more.

Either way, have you tried sending mail manually using e.g. netcat or telnet? Server might flat out tell you what's wrong during SMTP conversation.
What about logs? Is it trying to forward your local mail somewhere else? Does it need another MDA to finish the job?
Is a local delivery method defined in sendmail's config?
Are you able to send mail to other, remote servers?


For now I did not tried netcat or telnet. That could maybe leads me to what's not working yes, I would have to give it a try.

I do not see any logs about that, my system is supposed to use systemd default way.

About MDA I was thinking it was kind of useless since it's a simple local message.

I did not do any config for sendmail, so far as I remember, hopping it was more or less by default working for such task.

And no, I can't send mail anywhere, even locally it seems.

Regards,
GASPARD DE RENEFORT Kévin
_________________
Traduction wiki, pour praticiper.
Custom logos/biz card/website.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3415

PostPosted: Mon Sep 30, 2024 8:23 am    Post subject: Reply with quote

Quote:
About MDA I was thinking it was kind of useless since it's a simple local message.
Yeah, I'd think that too, but when things don't work as expected it's time to question everything.
Unfortunately we don't have a lot to work with right now
_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
kgdrenefort
Guru
Guru


Joined: 19 Sep 2023
Posts: 312
Location: Somewhere in the 77

PostPosted: Fri Oct 04, 2024 10:12 am    Post subject: Reply with quote

Hello,

After some research and trying, I realized a few things:

1/ The 'sendmail' service has to be started. Now I can reach port 25 locally using telnet, which was not the case before.

Code:
localhost /etc/mail # telnet localhost 25
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost ESMTP Sendmail 8.17.1.9/8.17.1.9; Fri, 4 Oct 2024 12:10:47 +0200



2/ It seems I needed to do a bit of configuration, that's messy but I tried to follow a few things, into /etc/mail.

I edited a few files, trying to understand how this should works.

/etc/mail/aliases:

Code:
root: code


If I understand, mail for root are now forwarded to code Unix user's mailbox. Now I have:

Code:
/var/spool/mail/code


right next to the root mbox file. Both are empty.

This edit was followed by the command:

Code:
newaliases


And:

Code:
systemctl restart sendmail


/etc/mail/access:

Code:
127.0.0 RELAY


I guess this means that mails should use localhost as a RELAY. I also guess this is fine for local works only. Which is, for now, my goal.

Of course this edit was followed by this command:

Code:
makemap hash /etc/mail/access.db < /etc/mail/access


/etc/mail/local-host-names:

Code:
localhost


I was trying to get rid of this message about FQDN… Not better:

Code:
WARNING: local host name (localhost) is not qualified; see cf/README: WHO AM I?


To be honest, I don't see why I should need a fully qualified domain name for local mail delivery, IIRC it was important, mandatory, for mail across a real network, not for local stuff. But my mails skills are most rusty than the Titanic.

I think that's all my edits so far.

If I start the service and try to send an e-mail to root, this is what I get for the sendmail service:

Code:
● sendmail.service - Sendmail Mail Transport Agent
     Loaded: loaded (/usr/lib/systemd/system/sendmail.service; disabled; preset: disabled)
     Active: active (running) since Fri 2024-10-04 11:49:12 CEST; 15min ago
    Process: 1084903 ExecStartPre=/usr/bin/newaliases (code=exited, status=0/SUCCESS)
    Process: 1085007 ExecStartPre=/bin/rm -f /var/spool/mqueue/xf* (code=exited, status=0/SUCCESS)
    Process: 1085009 ExecStart=/usr/sbin/sendmail -bd -q30m -L sm-mta (code=exited, status=0/SUCCESS)
   Main PID: 1085127 (sendmail)
      Tasks: 1 (limit: 4237)
        CPU: 150ms
     CGroup: /system.slice/sendmail.service
             └─1085127 "sendmail: accepting connections"

oct. 04 11:48:12 localhost sendmail[1084903]: alias database /etc/mail/aliases rebuilt by root
oct. 04 11:48:12 localhost newaliases[1084903]: /etc/mail/aliases: 22 aliases, longest 10 bytes, 229 bytes total
oct. 04 11:48:12 localhost sendmail[1084903]: /etc/mail/aliases: 22 aliases, longest 10 bytes, 229 bytes total
oct. 04 11:48:12 localhost sm-mta[1085009]: My unqualified host name (localhost) unknown; sleeping for retry
oct. 04 11:49:12 localhost sm-mta[1085009]: unable to qualify my own domain name (localhost) -- using short name
oct. 04 11:49:12 localhost sm-mta[1085127]: starting daemon (8.17.1.9): SMTP+queueing@00:30:00
oct. 04 11:49:12 localhost systemd[1]: sendmail.service: Can't open PID file /run/sendmail.pid (yet?) after start: No such file or directory
oct. 04 11:49:12 localhost systemd[1]: Started Sendmail Mail Transport Agent.
oct. 04 11:53:58 localhost sm-mta[1085703]: 4949rwQa1085703: from=<code@localhost>, size=260, class=0, nrcpts=1, msgid=<202410040953.4949rwis1085586@localhost>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
oct. 04 11:53:58 localhost sm-mta[1085704]: 4949rwQa1085703: to=code, ctladdr=<code@localhost> (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30438, dsn=2.0.0, stat=Sent


Here, we can see that at 11:53:58 I send an e-mail from code, to root (redirected to code mailbox). The status said it's sent, but can't find anything in /var/spool/mail about these e-mail. Not even in a queue so far as I can see.

Despite this message:
Code:
sendmail.service: Can't open PID file /run/sendmail.pid (yet?) after start: No such file or directory


I have :

Code:
# cat /run/sendmail.pid
1085127
/usr/sbin/sendmail -bd -q30m -L sm-mta


We can also see this:

Code:
oct. 04 11:48:12 localhost sm-mta[1085009]: My unqualified host name (localhost) unknown; sleeping for retry
oct. 04 11:49:12 localhost sm-mta[1085009]: unable to qualify my own domain name (localhost) -- using short name


As said, I do not see why for local delivery a FQDN should be necessary, for now I think it's more a warning than anything else.

We can see the mbox are empty:

Code:
localhost /etc/mail # cat /var/spool/mail/*
localhost /etc/mail # ls /var/spool/mail/
code  root


Below, we the content of some directory, the last one being old test, from last week.

Code:
localhost /etc/mail # ls /var/spool/mqueue/
localhost /etc/mail # ls /var/spool/clientmqueue/
sm-client.pid
localhost /etc/mail # ls /var/spool/nullmailer/queue/
1727426890.966327  1727426915.966330


I'm pretty much out of ideas, here.

Still looking for a working solution. I'll next try to use telnet to do a test and see how it goes…

Regards,
GASPARD DE RENEFORT Kévin
_________________
Traduction wiki, pour praticiper.
Custom logos/biz card/website.
Back to top
View user's profile Send private message
kgdrenefort
Guru
Guru


Joined: 19 Sep 2023
Posts: 312
Location: Somewhere in the 77

PostPosted: Fri Oct 04, 2024 10:21 am    Post subject: Reply with quote

A quick and dirty test:

Quote:
localhost /etc/mail # telnet localhost 25
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost ESMTP Sendmail 8.17.1.9/8.17.1.9; Fri, 4 Oct 2024 12:10:47 +0200
HELO localhost
250 localhost Hello localhost [127.0.0.1], pleased to meet you
MAIL FROM:<code@localhost>
250 2.1.0 <code@localhost>... Sender ok
RCPT TO:<root@localhost>
250 2.1.5 <root@localhost>... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
Subject: toto
Toto is a nice fellah, but I prefer foo and bar, as well.
.
250 2.0.0 494AAl5K1087705 Message accepted for delivery
quit
221 2.0.0 localhost closing connection
Connection closed by foreign host.


If I understand, it's supposed to be accepted for delivery, but it's not sent and is not in any queue.

Regards,
GASPARD DE RENEFORT Kévin
_________________
Traduction wiki, pour praticiper.
Custom logos/biz card/website.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3415

PostPosted: Fri Oct 04, 2024 10:42 am    Post subject: Reply with quote

Quote:
1/ The 'sendmail' service has to be started. Now I can reach port 25 locally using telnet, which was not the case before.
Oh, wow, I did not not expect THIS to be the problem :lol:

Quote:
Code:
root: code
If I understand, mail for root are now forwarded to code Unix user's mailbox.
yes
Quote:
Now I have: /var/spool/mail/code
No.
Spool is for queues. An IMAP and POP server, one with virtual users, may choose to keep inboxes there, but local delivery is unlikely to be configured this way. I think the traditional location for inbox was $HOME/mail. You should be able to read those with mail command, invoked without any parameters, as the user in question.

Quote:
I was trying to get rid of this message about FQDN… Not better:
put a line in /etc/hosts like
127.0.0.1 localhost.local localhost
Using a public interface may be necessary, since many servers ignore local loopback when resolving their own name. Alternatively, there's often an option in server's config file to set the hostname, the server should pick whichever valid option exists.
This value is used during SMTP conversation and also as an anti-spam measure. Other servers will not accept mail from a server that doesn't know its name (A and PTR must match), but using a local name, as reported by mail.log, should be fine in your scenario.

I don't know about that RELAY option in config; I don't know what it's supposed to do, but it may not be what you want. If mail didn't reach users' mailboxes (those in $HOME), it might be worth a second look. I never used sendmail myself, but I can imagine 127.0.0.1 RELAY causing an infinite loop. The server should notice, reject, and log it though, which didn't happen, so really check your inbox first.
_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
kgdrenefort
Guru
Guru


Joined: 19 Sep 2023
Posts: 312
Location: Somewhere in the 77

PostPosted: Fri Oct 04, 2024 11:19 am    Post subject: Reply with quote

I edited /etc/hosts and now it is:

Code:
127.0.0.1  localhost.local localhost


So far, same issue.

mailq says there is nothing in queue.

I can still try to send these…

Code:
oct. 04 13:12:06 localhost sm-mta[1103125]: 494BC6hr1103125: from=<code@localhost.local>, size=278, class=0, nrcpts=1, msgid=<202410041112.494BC68l1103124@localhost.local>, proto=ESMTP, daemon=MTA, relay=localhost.local [127.0.0.1]
oct. 04 13:12:06 localhost sm-mta[1103126]: 494BC6hr1103125: to=code, ctladdr=<code@localhost.local> (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30480, dsn=2.0.0, stat=Sent
oct. 04 13:12:12 localhost sm-mta[1103140]: 494BCCLA1103140: from=<code@localhost.local>, size=288, class=0, nrcpts=1, msgid=<202410041112.494BCCAe1103139@localhost.local>, proto=ESMTP, daemon=MTA, relay=localhost.local [127.0.0.1]
oct. 04 13:12:12 localhost sm-mta[1103141]: 494BCCLA1103140: to=code, ctladdr=<code@localhost.local> (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30490, dsn=2.0.0, stat=Sent
oct. 04 13:12:14 localhost sm-mta[1103150]: 494BCEBU1103150: from=<code@localhost.local>, size=294, class=0, nrcpts=1, msgid=<202410041112.494BCEuo1103149@localhost.local>, proto=ESMTP, daemon=MTA, relay=localhost.local [127.0.0.1]
oct. 04 13:12:14 localhost sm-mta[1103151]: 494BCEBU1103150: to=code, ctladdr=<code@localhost.local> (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30496, dsn=2.0.0, stat=Sent


So, if I understand, the /var/spool/mail hold mail to be delivered later.

While /var/mail actually contains the mailboxes, which are code and root and are also empty.

I also edited the RELAY to:

Code:
127.0.0.1 RELAY


Then:

Code:
makemap hash /etc/mail/access.db < /etc/mail/access


And restarting sendmail. Same.

Since it is supposed to be fully local.

Thanks for your time.

EDIT:

I was wrong, the mails are… as you stated it… In home:

Code:
localhost /etc/mail # grep -rin "toto" /home/*
/home/code/.bash_history:488:echo "Subject: toto" | sendmail root@localhost
/home/code/.bash_history:489:echo "Subject: toto_1" | sendmail -bv root@localhost
/home/code/.bash_history:492:echo "Subject: toto" | sendmail root
/home/code/.bash_history:493:echo "Subject: toto3" | sendmail root
grep: /home/code/.viminfo : fichiers binaires correspondent
/home/code/.maildir/new/1728035018.1084880_1.localhost:11:Subject: toto
/home/code/.maildir/new/1728035638.1085706_0.localhost:11:Subject: toto
/home/code/.maildir/new/1728037102.1088598_0.localhost:8:Subject: toto
/home/code/.maildir/new/1728037102.1088598_0.localhost:10:Toto is a nice fellah, but I prefer foo and bar, as well.
/home/code/.maildir/new/1728039678.1101735_0.localhost:11:Subject: toto
/home/code/.maildir/new/1728039798.1101979_0.localhost:8:Subject: toto is a bitch
/home/code/.maildir/new/1728039921.1102271_0.localhost:11:Subject: toto
/home/code/.maildir/new/1728039991.1102416_0.localhost:8:Subject: toto
/home/code/.maildir/new/1728039991.1102416_0.localhost:10:toto
/home/code/.maildir/new/1728040152.1102744_0.localhost:11:Subject: toto
/home/code/.maildir/new/1728040157.1102759_0.localhost:11:Subject: toto
/home/code/.maildir/new/1728040326.1103127_0.localhost:11:Subject: toto
/home/code/.maildir/new/1728040332.1103143_0.localhost:11:Subject: toto
/home/code/.maildir/new/1728040334.1103152_0.localhost:11:Subject: toto
localhost /etc/mail # cd /home/code/.maildir/
localhost /home/code/.maildir # ls
cur  new  tmp
localhost /home/code/.maildir # ls cur/
localhost /home/code/.maildir # ls new/
1728035018.1084880_1.localhost  1728037102.1088598_0.localhost  1728039798.1101979_0.localhost  1728039991.1102416_0.localhost  1728040157.1102759_0.localhost  1728040332.1103143_0.localhost
1728035638.1085706_0.localhost  1728039678.1101735_0.localhost  1728039921.1102271_0.localhost  1728040152.1102744_0.localhost  1728040326.1103127_0.localhost  1728040334.1103152_0.localhost
localhost /home/code/.maildir # ls tmp/
localhost /home/code/.maildir #


so, into new/ I have a lot of these… Should I conclude this is working ?

Regards,
GASPARD DE RENEFORT Kévin
_________________
Traduction wiki, pour praticiper.
Custom logos/biz card/website.
Back to top
View user's profile Send private message
kgdrenefort
Guru
Guru


Joined: 19 Sep 2023
Posts: 312
Location: Somewhere in the 77

PostPosted: Fri Oct 04, 2024 11:37 am    Post subject: Reply with quote

It seems to be fully working.

Another test:

Code:
localhost /home/code/.maildir # telnet localhost.local 25
Trying 127.0.0.1...
Connected to localhost.local.
Escape character is '^]'.
220 localhost.local ESMTP Sendmail 8.17.1.9/8.17.1.9; Fri, 4 Oct 2024 13:32:26 +0200
HELO localhost.local
250 localhost.local Hello localhost.local [127.0.0.1], pleased to meet you
MAIL FROM:<code@localhost>
250 2.1.0 <code@localhost>... Sender ok
RCPT TO:<code@localhost>
250 2.1.5 <code@localhost>... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
Subject: tata
tata !!!
.
250 2.0.0 494BWQGc1105547 Message accepted for delivery
quit
221 2.0.0 localhost.local closing connection
Connection closed by foreign host.


Code:
localhost /home/code/.maildir # grep -rin "tata" *
new/1728041588.1105630_0.localhost:8:Subject: tata
new/1728041588.1105630_0.localhost:10:tata !!!


Regards,
GASPARD DE RENEFORT Kévin
_________________
Traduction wiki, pour praticiper.
Custom logos/biz card/website.
Back to top
View user's profile Send private message
kgdrenefort
Guru
Guru


Joined: 19 Sep 2023
Posts: 312
Location: Somewhere in the 77

PostPosted: Fri Oct 04, 2024 12:09 pm    Post subject: Reply with quote

I decided to try and see if my contact form written in PHP was working, seems to, I was able to use it to send an e-mail locally:

Code:
Return-Path: <nobody@localhost.local>
Received: from localhost.local (localhost.local [127.0.0.1])
   by localhost.local (8.17.1.9/8.17.1.9) with ESMTP id 494C7o2J1109734
   for <root@localhost.local>; Fri, 4 Oct 2024 14:07:50 +0200
Received: (from nobody@localhost)
   by localhost.local (8.17.1.9/8.17.1.9/Submit) id 494C7ocd1109733;
   Fri, 4 Oct 2024 14:07:50 +0200
Date: Fri, 4 Oct 2024 14:07:50 +0200
From: System user <nobody@localhost.local>
Message-Id: <202410041207.494C7ocd1109733@localhost.local>
To: root@localhost.local
Subject: This is a simple test.

This is a simple test lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem lorem


I think this should be considered as working, but if you have anything else to add, will be glad !

Thanks for your time.

Regards,
GASPARD DE RENEFORT Kévin
_________________
Traduction wiki, pour praticiper.
Custom logos/biz card/website.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3415

PostPosted: Fri Oct 04, 2024 12:35 pm    Post subject: Reply with quote

That's great, you've got your mail delivered, so it's looking good.

You should now make sure your server won't be used by spammers though. Now, localhost is typically considered a trusted machine, so outgoing mail will always be accepted. For this test, try connecting from a different machine to 25/tcp and sending a mail to a user in a domain your server doesn't host.
Your server should reject all attempts to send from your domain by unauthenticated users (regardless of destination address), and it should reject any relay attempts (mail from not-your-domain to not-your-domain).
One this is done, you can consider this mission a success ;)
_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
kgdrenefort
Guru
Guru


Joined: 19 Sep 2023
Posts: 312
Location: Somewhere in the 77

PostPosted: Mon Oct 07, 2024 10:58 am    Post subject: Reply with quote

szatox wrote:
That's great, you've got your mail delivered, so it's looking good.

You should now make sure your server won't be used by spammers though. Now, localhost is typically considered a trusted machine, so outgoing mail will always be accepted. For this test, try connecting from a different machine to 25/tcp and sending a mail to a user in a domain your server doesn't host.
Your server should reject all attempts to send from your domain by unauthenticated users (regardless of destination address), and it should reject any relay attempts (mail from not-your-domain to not-your-domain).
One this is done, you can consider this mission a success ;)


This is useless in my case.

Now it does not use sendmail anymore, it was purely for testing before even trying to send anything to any ESP's SMTP server.

As suggested on #php@libera.chat, I send the mail using PHPMailer for convenience. And it works very well !

This server is a devbox, only accessible on my LAN network, to avoid pushing anything on my actual server until it's ready.

Thanks nonetheless for all your guidance.

Regards,
GASPARD DE RENEFORT Kévin
_________________
Traduction wiki, pour praticiper.
Custom logos/biz card/website.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum