Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
3
answers
3688
views
How to send mail from Linux with To, From, Subject, and File Attachment
I need to be able to send mail from a bash script with the following: To Address, From Address, Subject, Body Text, and File Attachment I can send everything just perfectly using mutt EXCEPT, no matter what I do the "From" address does not get set correctly: e.g. mutt -e "my_hdr From:${FROM}")... I...
I need to be able to send mail from a bash script with the following:
To Address, From Address, Subject, Body Text, and File Attachment
I can send everything just perfectly using mutt EXCEPT, no matter what I do the "From" address does not get set correctly:
e.g. mutt -e "my_hdr From:${FROM}")...
I can also use sendmail or mailx but I can't seem to get the file attachment and the body text correct.
e.g. sendmail -t -a file
SSDdude
(171 rep)
Jun 7, 2018, 05:44 PM
• Last activity: Aug 6, 2025, 06:03 PM
0
votes
1
answers
3785
views
configure sendmail for php email()
Recently I installed sendmail in Ubuntu sudo apt install sendmail sudo sendmailconfig When I try to send mail using php `email();` function to send email $to = "myemail@gmail.com"; $subject = "Mail Test at ".strftime("%T", time()); $message = "This is a test."; $message = wordwrap($message, 70); $fr...
Recently I installed sendmail in Ubuntu
sudo apt install sendmail
sudo sendmailconfig
When I try to send mail using php
email();
function to send email
$to = "myemail@gmail.com";
$subject = "Mail Test at ".strftime("%T", time());
$message = "This is a test.";
$message = wordwrap($message, 70);
$from = "anotheremail@gmail.com";
$headers = "From: {$from}";
$result = mail($to, $subject, $message, $headers);
echo $result ? "sent" : "error";
Now when I browse the php site I get sent message but I don't get email (in my official email).
Can anybody help?
maverick
(101 rep)
Jan 24, 2018, 08:22 AM
• Last activity: Jul 28, 2025, 01:01 AM
1
votes
1
answers
2818
views
sending alerts from linux machine through email to MS outlook exchange
I Have a Scenario. I have written a shell script who check the space of mount point '/u06'. if free space is greater then 20% then its OK or if free space is less then 20% then it should generate a mail and send it to System Administrator. Our organization is using MS Outlook mailing. I want to know...
I Have a Scenario. I have written a shell script who check the space of mount point '/u06'. if free space is greater then 20% then its OK or if free space is less then 20% then it should generate a mail and send it to System Administrator. Our organization is using MS Outlook mailing. I want to know how can I send alerts through my Linux machine to exchange server. How to configure email in Linux?
M. AZ
(11 rep)
Aug 31, 2016, 07:49 AM
• Last activity: Jun 13, 2025, 01:10 AM
0
votes
1
answers
17935
views
Sendmail error dsn=4.0.0 stat=Deferred: Connection refused by [127.0.0.1]
I am at a loss to what is causing my issue but when trying to send a mail from my server i see this in my `maillog`: > Oct 16 12:11:19 MYSERVER sendmail[63109]: v9GBBJxD063109: > to=myemail@address.com, ctladdr=root (0/0), delay=00:00:00, > xdelay=00:00:00, mailer=relay, pri=60384, relay=[127.0.0.1]...
I am at a loss to what is causing my issue but when trying to send a mail from my server i see this in my
maillog
:
> Oct 16 12:11:19 MYSERVER sendmail: v9GBBJxD063109:
> to=myemail@address.com, ctladdr=root (0/0), delay=00:00:00,
> xdelay=00:00:00, mailer=relay, pri=60384, relay=[127.0.0.1]
> [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by
> [127.0.0.1]
From the research i've done it was thought the issue was a global writable file in the /etc/mail
folder but i dont see one in there.
Anyone know what else to look at?
a.smith
(745 rep)
Oct 16, 2017, 11:15 AM
• Last activity: Jun 12, 2025, 04:06 PM
4
votes
1
answers
3949
views
Sendmail issues "530 Authentication required" error message when authinfo is supplied
`sender_email` - email address that does not exist, but must be used as FROM address, because receiver host rejects emails from other emails. `receiver_email` - email that is supposed to receive the sent message `local_smtp` - SMTP server that is installed on another computer in the local network an...
sender_email
- email address that does not exist, but must be used as FROM address, because receiver host rejects emails from other emails.
receiver_email
- email that is supposed to receive the sent message
local_smtp
- SMTP server that is installed on another computer in the local network and forwards all received messages to external_smtp
external_smtp
- SMTP server that is installed on a computer in another network and rejects all emails that do not come from sender_email
I have configured sendmail to send emails from sender_email
and authenticate with user/password to local_smtp
that is supposed to send the email message further to external_smtp
that only accepts emails sent from a specific email, which is sender_email
in this case. However, judging from the log files sendmail authenticates with external_smtp
instead of local_smtp
. I do not want to authenticate with external_smtp
, because that is up to local_smtp
.
logfile
:
10745 >> EHLO mgmt-snmp
10759 >> MAIL From: AUTH=sender_email
10759 >> This is a MIME-encapsulated message
10759 >>>
10759 >>> --t8IEdmbX010759.1442587188/mgmt-snmp
10759 >>>
10759 >>> The original message was received at Fri, 18 Sep 2015 16:39:48 +0200
10759 >>> from root@localhost
10759 >>>
10759 >>> ----- The following addresses had permanent fatal errors -----
10759 >>> receiver_email
10759 >>> (reason: 530 authentication required)
10759 >>>
I guess it has something to do with AUTH=sender_email
, but I do not know how to change it.
sendmail.mc
:
divert(-1)dnl
#-----------------------------------------------------------------------------
# $Sendmail: debproto.mc,v 8.14.4 2014-02-11 13:02:08 cowboy Exp $
#
# Copyright (c) 1998-2010 Richard Nelson. All Rights Reserved.
#
# cf/debian/sendmail.mc. Generated from sendmail.mc.in by configure.
#
# sendmail.mc prototype config file for building Sendmail 8.14.4
#
# Note: the .in file supports 8.7.6 - 9.0.0, but the generated
# file is customized to the version noted above.
#
# This file is used to configure Sendmail for use with Debian systems.
#
# If you modify this file, you will have to regenerate /etc/mail/sendmail.cf
# by running this file through the m4 preprocessor via one of the following:
# * make (or make -C /etc/mail)
# * sendmailconfig
# * m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
# The first two options are preferred as they will also update other files
# that depend upon the contents of this file.
#
# The best documentation for this .mc file is:
# /usr/share/doc/sendmail-doc/cf.README.gz
#
#-----------------------------------------------------------------------------
divert(0)dnl
#
# Copyright (c) 1998-2005 Richard Nelson. All Rights Reserved.
#
# This file is used to configure Sendmail for use with Debian systems.
#
define(`_USE_ETC_MAIL_')dnl
include(`/usr/share/sendmail/cf/m4/cf.m4')dnl
VERSIONID(`$Id: sendmail.mc, v 8.14.4-4.1ubuntu1 2014-02-11 13:02:08 cowboy Exp $')
OSTYPE(`debian')dnl
DOMAIN(`debian-mta')dnl
dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE
undefine(`confHOST_STATUS_DIRECTORY')dnl #DAEMON_HOSTSTATS=
dnl # Items controlled by /etc/mail/sendmail.conf - DO NOT TOUCH HERE
dnl #
dnl # General defines
dnl #
dnl # SAFE_FILE_ENV: [undefined] If set, sendmail will do a chroot()
dnl # into this directory before writing files.
dnl # If *all* your user accounts are under /home then use that
dnl # instead - it will prevent any writes outside of /home !
dnl # define(confSAFE_FILE_ENV',
')dnl
dnl #
dnl # Daemon options - restrict to servicing LOCALHOST ONLY !!!
dnl # Remove `, Addr=' clauses to receive from any interface
dnl # If you want to support IPv6, switch the commented/uncommentd lines
dnl #
FEATURE(`no_default_msa')dnl
dnl DAEMON_OPTIONS(`Family=inet6, Name=MTA-v6, Port=smtp, Addr=::1')dnl
DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Port=smtp')dnl
dnl DAEMON_OPTIONS(`Family=inet6, Name=MSP-v6, Port=submission, M=Ea, Addr=::1')dnl
DAEMON_OPTIONS(`Family=inet, Name=MSP-v4, Port=submission, M=Ea, Addr=127.0.0.1')dnl
dnl #
dnl # Be somewhat anal in what we allow
define(`confPRIVACY_FLAGS',dnl
`needmailhelo,needexpnhelo,needvrfyhelo,restrictqrun,restrictexpand,nobodyreturn,authwarnings')dnl
dnl #
dnl # Define connection throttling and window length
define(confCONNECTION_RATE_THROTTLE',
15')dnl
define(confCONNECTION_RATE_WINDOW_SIZE',
10m')dnl
dnl #
dnl # Features
dnl #
dnl # use /etc/mail/local-host-names
FEATURE(`use_cw_file')dnl
dnl #
dnl # The access db is the basis for most of sendmail's checking
FEATURE(access_db', ,
skip')dnl
dnl #
dnl # The greet_pause feature stops some automail bots - but check the
dnl # provided access db for details on excluding localhosts...
FEATURE(greet_pause',
1000')dnl 1 seconds
dnl #
dnl # Delay_checks allows senderrecipient checking
FEATURE(delay_checks',
friend', `n')dnl
dnl #
dnl # If we get too many bad recipients, slow things down...
define(confBAD_RCPT_THROTTLE',
3')dnl
dnl #
dnl # Stop connections that overflow our concurrent and time connection rates
FEATURE(conncontrol',
nodelay', `terminate')dnl
FEATURE(ratecontrol',
nodelay', `terminate')dnl
dnl #
dnl # If you're on a dialup link, you should enable this - so sendmail
dnl # will not bring up the link (it will queue mail for later)
dnl define(confCON_EXPENSIVE',
True')dnl
dnl #
dnl # Dialup/LAN connection overrides
dnl #
include(`/etc/mail/m4/dialup.m4')dnl
include(`/etc/mail/m4/provider.m4')dnl
dnl LOCAL_CONFIG
dnl EXPOSED_USER(root uucp)dnl # users exempt from masquerading
dnl LOCAL_USER(root)dnl
dnl MASQUERADE_AS(`external_smtp')dnl
dnl FEATURE(`allmasquerade')dnl
dnl FEATURE(`masquerade_envelope')dnl
dnl FEATURE(`nullclient', local_smtp)dnl
LOCAL_CONFIG
## Custom configurations below (will be preserved)
define(SMART_HOST',
local_smtp')dnl
define(confAUTH_MECHANISMS',
EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(authinfo',
hash /etc/mail/authinfo')dnl
define(RELAY_MAILER_ARGS',
TCP $h 25')dnl
dnl #
dnl # Default Mailer setup
MAILER_DEFINITIONS
MAILER(`local')dnl
MAILER(`smtp')dnl
authinfo
:
AuthInfo:local_smtp "U:root" "I:my_username" "P:my_password"
Jonas
(143 rep)
Sep 18, 2015, 03:21 PM
• Last activity: Jun 11, 2025, 05:03 PM
2
votes
1
answers
2219
views
SMTP connectivity issue in Zenoss ("Connection unexpectedly closed")
I am using Zenoss for monitoring purpose. I have been using its mail service for a long time. Suddenly my mail service in zenoss stopped and started showing ` - Connection unexpectedly closed` and no mails are outgoing. When I ran the mail command via CLI, the mail goes to the email address. While e...
I am using Zenoss for monitoring purpose. I have been using its mail service for a long time. Suddenly my mail service in zenoss stopped and started showing
- Connection unexpectedly closed
and no mails are outgoing. When I ran the mail command via CLI, the mail goes to the email address. While executing the zenoss script for mailer won't work and throws out the error as shown above.
My server is RHEL 5.3 x86_64, with Zenoss 4.2 & sendmail email server.
### Sendmail logs & Zenoss email conf
Apr 11 07:14:30 XXXhostnameXX sendmail: r3BBDgia013582: lost input channel from localhost.localdomain [127.0.0.1] to MTA after mail
Apr 11 07:14:30 XXXhostnameXX sendmail: r3BBDgia013582: from=, size=146972, class=0, nrcpts=0, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Zenoss is following basic smtp connection as emailing is done by local sendmail server (localhost) in port 25. No specific configuration is used.
Kratos
(381 rep)
Apr 11, 2013, 10:55 AM
• Last activity: Jun 1, 2025, 08:05 PM
3
votes
1
answers
3006
views
sendmail default sender
I have a lot of servers, let's say our company network is called `Loosers`, when using this command echo "Subject: testmail $(hostname)" | sendmail -v 'myemail@mycompany.com' I effectively receive an email after a few minutes, but the sender is like `hostname@mail.loosers` instead of something like...
I have a lot of servers, let's say our company network is called
Loosers
, when using this command
echo "Subject: testmail $(hostname)" | sendmail -v 'myemail@mycompany.com'
I effectively receive an email after a few minutes, but the sender is like hostname@mail.loosers
instead of something like noreply.hostname@mail.mycompany.com
.
Since my predecessor stupidly set the domain to something specifically related to my company, I suppose it is possible to change this email. I browsed my server in /etc/mail/*
, then the manual of sendmail, then the Internet in the search of the configuration of sendmail
. Nowhere can be found the string looser
or mail
. I cannot grasp where my predecessor configurated this stupid default sender of sendmail
.
How can I configure the default sender used by the bash command sendmail
?
MUY Belgium
(1282 rep)
Mar 15, 2019, 08:59 AM
• Last activity: May 1, 2025, 02:07 PM
1
votes
0
answers
43
views
How to instruct sendmail not to prepend email addresses with the local user's name?
Having installed `sendmail`, I added define(`MAIL_HUB', `mydomain.com.')dnl define(`LOCAL_RELAY', `mydomain.com.')dnl to `.mc` and recompiled. Now the delivery to `myself@mydomain.com` fails because `sendmail` prepends the address with my local Linux user name. It adds `myusername@` and on the 1st a...
Having installed
sendmail
, I added
define(MAIL_HUB',
mydomain.com.')dnl
define(LOCAL_RELAY',
mydomain.com.')dnl
to .mc
and recompiled. Now the delivery to myself@mydomain.com
fails because sendmail
prepends the address with my local Linux user name. It adds myusername@
and on the 1st attempt it tries to deliver to myusername@myself@mydomain.com
, and on the 2nd attempt it tries myusername@mydomain.com
.
What settings do I have to add, to instruct it to send to whatever email address I need to?
The purpose of this is to only ever send to this one address/domain because this is a web server box whose sole purpose is to deliver 2FA emails to admin of the site that it hosts and to nowhere and no one else, all on my LAN. I presume that when PHP will begin to send those emails addresses would be prepended with www-data@
. In theory it is probably possible to set that up as an alias to myself, on the SMTP server, but I am not sure the web site will allow me to enter just mydomain.com
for the admin's email address. It will probably prevent me from doing it by validating against some email regex.
SuperAl
(151 rep)
Apr 15, 2025, 11:20 PM
0
votes
1
answers
29
views
nslookup times out when type is set to MX
In order to send 2FA emails from a PHP web site to myself, I set up an MX record override and created a firewall rule that allows access to the mail server for the destination domain, but when I attempt to send, `sendmail` writes to its log that email is accepted for delivery but never delvers. To t...
In order to send 2FA emails from a PHP web site to myself, I set up an MX record override and created a firewall rule that allows access to the mail server for the destination domain, but when I attempt to send,
sendmail
writes to its log that email is accepted for delivery but never delvers.
To test the DNS name resolution, I run nslookup
and enter type=MX
command, but it always prints:
;; communications error to 10.0.0.1#53: timed out
;; communications error to 10.0.0.1#53: timed out
;; communications error to 10.0.0.1#53: timed out
;; no servers could be reached
When I ping
, telnet
, or curl
, etc, the name resolution by that DNS server works fine. For example, it can install packages from Debian repos.
From that little information about sendmail
, which I was able to absorb, it sounds like all it needs to deliver to admin@example.com
is an MX record for example.com
to point at smtp.example.com
. Correct me if I am wrong. All of these items seem to be in place: there is an MX record for example.com
on my DNS server; it points at smtp.example.com
that also has an A record; I am sending to admin@example.com
; there is a firewall rule that allows the Linux box with sendmail
to resolve names with the DNS server; there is a firewall rule that allows the Linux box with sendmail
to send emails to smtp.example.com
. All of this exists in my LAN and does not need any access to the outside Internet.
How should I troubleshoot the sendmail delivery in this situation?
**EDIT**:
In the mean time I found out the root cause of the failing sendmail
: it prepends whatever email address I use on the command line with the currently logged in user name (without regard to su
), i.e. if my user name is myusername
, then it changes me@mydomain
to myusername@me@mydomain
on the 1st attempt and myusername@mydomain
on the 2nd attempt.
Something is missing from sendmail.mc
, but what is it?
SuperAl
(151 rep)
Apr 15, 2025, 10:11 PM
• Last activity: Apr 15, 2025, 11:09 PM
1
votes
2
answers
4786
views
How to check STARTTLS usage when sending emails with sendmail?
I have installed and configured `sendmail` on my little VPS running Debian in order to send some e-mail notifications when something happens on it. Currently, the setup seems to work fine but, since these notifications can contain some sensitive data, I would like to encrypt them. So, running severa...
I have installed and configured
sendmail
on my little VPS running Debian in order to send some e-mail notifications when something happens on it. Currently, the setup seems to work fine but, since these notifications can contain some sensitive data, I would like to encrypt them.
So, running several time the sendmailconfig
command, I noticed that sendmail
can be configured to use STARTTLS:
Everything you need to support STARTTLS (encrypted mail transmission
and user authentication via certificates) is installed and configured
but is *NOT* being used.
To enable sendmail to use STARTTLS, you need to:
1) Add this line to /etc/mail/sendmail.mc and optionally
to /etc/mail/submit.mc:
include(`/etc/mail/tls/starttls.m4')dnl
2) Run sendmailconfig
3) Restart sendmail
I have added the above mentioned statement in the appropriate configuration file and all seems to still work. But sending a test e-mail with the -v
parameter, the console output doesn't seem to be different compared to previous tests (I see statements like 050 250-STARTTLS
or 050 >>> STARTTLS
but they were printed also before setting up STARTTLS).
So, how could I check if sendmail
is actually encrypting e-mails?
**Question Update n.1**
As suggested in some comments, I am going to attach the conversation content of some tests I did in the previous hours.
Emulating this conversation, here is the one I did with my local SMTP:
$ netcat -Cw 60 localhost 25
220 mail.MYDOMAIN.com ESMTP Sendmail 8.15.2/8.15.2/Debian-14~deb10u1; Fri, 5 Jun 2020 14:40:15 GMT; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
EHLO localhost
250-mail.MYDOMAIN.com 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-STARTTLS
250-DELIVERBY
250 HELP
MAIL FROM:
250 2.1.0 ... Sender ok
RCPT TO:
250 2.1.5 ... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
From:
To:
Subject: Sendmail test
.
250 2.0.0 055EeF7x000698 Message accepted for delivery
QUIT
221 2.0.0 mail.MYDOMAIN.com closing connection
But when trying to do the same on Outlook SMTP server (since the recipient for the mentioned notifications is my free Outlook e-mail), the conversation stops at the second step:
$ netcat -Cw 60 smtp-mail.outlook.com 25
220 LO2P265CA0139.outlook.office365.com Microsoft ESMTP MAIL Service ready at Fri, 5 Jun 2020 14:56:40 +0000
EHLO mail.MYDOMAIN.com
250-LO2P265CA0139.outlook.office365.com Hello [MYIP]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8
MAIL FROM:
530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [LO2P265CA0139.GBRP265.PROD.OUTLOOK.COM]
I have also tried to compare the header of some e-mails, which were respectively sent before and after the STARTTLS setup and I found an interesting difference:
Received: from mail.MYDOMAIN.com (localhost [127.0.0.1])
by mail.MYDOMAIN.com (8.15.2/8.15.2/Debian-14~deb10u1) with ESMTPS id 054G4khN002213
(version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT)
for ; Thu, 4 Jun 2020 16:04:46 GMT
The encryption information between parenthesis is not present in previous e-mail headers. Can this be a clue that STARTTLS is actually used?
**Question Update n.2**
If it can be useful, I attach also what sendmail
outputs to console in verbose mode when sending test e-mails:
$ echo 'Subject: Sendmail test' | sudo sendmail -v -f foo@bar.com MYEMAIL@outlook.com
MYEMAIL@outlook.com... Connecting to [127.0.0.1] via relay...
220 mail.MYDOMAIN.com ESMTP Sendmail 8.15.2/8.15.2/Debian-14~deb10u1; Sun, 7 Jun 2020 12:28:05 GMT; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]
>>> EHLO mail.musnet.io
250-mail.MYDOMAIN.com 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-STARTTLS
250-DELIVERBY
250 HELP
>>> VERB
250 2.0.0 Verbose mode
>>> STARTTLS
220 2.0.0 Ready to start TLS
>>> EHLO mail.musnet.io
250-mail.MYDOMAIN.com 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: SIZE=23 AUTH=foo@bar.com
250 2.1.0 ... Sender ok
>>> RCPT To:
>>> DATA
250 2.1.5 ... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
050 ... Connecting to outlook-com.olc.protection.outlook.com. via esmtp...
050 220 DM6NAM12FT067.mail.protection.outlook.com Microsoft ESMTP MAIL Service ready at Sun, 7 Jun 2020 12:28:05 +0000
050 >>> EHLO mail.MYDOMAIN.com
050 250-DM6NAM12FT067.mail.protection.outlook.com Hello [MYIP]
050 250-SIZE 49283072
050 250-PIPELINING
050 250-DSN
050 250-ENHANCEDSTATUSCODES
050 250-STARTTLS
050 250-8BITMIME
050 250-BINARYMIME
050 250-CHUNKING
050 250 SMTPUTF8
050 >>> STARTTLS
050 220 2.0.0 SMTP server ready
050 >>> EHLO mail.MYDOMAIN.com
050 250-DM6NAM12FT067.mail.protection.outlook.com Hello [MYIP]
050 250-SIZE 49283072
050 250-PIPELINING
050 250-DSN
050 250-ENHANCEDSTATUSCODES
050 250-8BITMIME
050 250-BINARYMIME
050 250-CHUNKING
050 250 SMTPUTF8
050 >>> MAIL From: SIZE=305
050 250 2.1.0 Sender OK
050 >>> RCPT To:
050 >>> DATA
050 250 2.1.5 Recipient OK
050 354 Start mail input; end with .
050 >>> .
050 250 2.6.0 [InternalId=29785598229520, Hostname=DM6NAM12HT069.eop-nam12.prod.protection.outlook.com] 7377 bytes in 0.217, 33.122 KB/sec Queued mail for delivery -> 250 2.1.5
050 ... Sent ( [InternalId=29785598229520, Hostname=DM6NAM12HT069.eop-nam12.prod.protection.outlook.com] 7377 bytes in 0.217, 33.122 KB/sec Queued mail for delivery -> 250 2.1.5)
250 2.0.0 057CS569006414 Message accepted for delivery
MYEMAIL@outlook.com... Sent (057CS569006414 Message accepted for delivery)
Closing connection to [127.0.0.1]
>>> QUIT
221 2.0.0 mail.MYDOMAIN.com closing connection
rudicangiotti
(123 rep)
Jun 3, 2020, 05:13 PM
• Last activity: Apr 4, 2025, 02:04 AM
2
votes
2
answers
2333
views
sendmail uses too much cpu
I am running Fedora 31 and time to time I get high CPU for dozen of seconds randomly during the time like every ten minutes or so that is caused by ``sendmail``. So far I am not able find out why. Can you help me to find what is the root cause of it and how to prevent it. Momentarily I am not aware...
I am running Fedora 31 and time to time I get high CPU for dozen of seconds randomly during the time like every ten minutes or so that is caused by `
sendmail
`.
So far I am not able find out why.
Can you help me to find what is the root cause of it and how to prevent it. Momentarily I am not aware of any service/job that could run that process. It happens in computer idle state as well.
Here is my observation so far my:
When the usage of CPU is high I can `ps faux | grep sendmail
`
ps faux | grep sendmail
/usr/bin/bash /usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t -f
Process `which sendmail
`
$ which sendmail
/usr/sbin/sendmail
$ ls -la /usr/sbin/sendmail
lrwxrwxrwx 1 root root 21 Mar 3 11:14 /usr/sbin/sendmail -> /etc/alternatives/mta
$ ls -la /etc/alternatives/mta
lrwxrwxrwx 1 root root 22 Mar 3 11:14 /etc/alternatives/mta -> /usr/bin/esmtp-wrapper
$ ls -la /usr/bin/esmtp-wrapper
-rwxr-xr-x 1 root root 3378 Jul 25 2019 /usr/bin/esmtp-wrapper
$ ls -la /usr/bin/esmtp-wrapper
I tried see `mail
`
$ mail
No mail for
All files in `var/spool/mail/
are empty,
/var/log/maillog
` is empty.
Any ideas?
ino
(357 rep)
Apr 15, 2020, 12:22 PM
• Last activity: Apr 1, 2025, 01:10 PM
0
votes
0
answers
60
views
How do I add spamassassin to my Fedora / sendmail / dovecot mail server?
As part of my nerdy home system, I have a Fedora Linux server, which is my file server, my web server and my mail server. For almost 20 years, my incoming mail was scrubbed by a spam filtering service operated by my friend in Switzerland, but he is now retiring, so I need to do this for myself now....
As part of my nerdy home system, I have a Fedora Linux server, which is my file server, my web server and my mail server.
For almost 20 years, my incoming mail was scrubbed by a spam filtering service operated by my friend in Switzerland, but he is now retiring, so I need to do this for myself now.
I figure the tool of choice is
spamassassin
, but where do I find a reasonably simple how-to guide? I assume I cannot just
dnf install spamassassin
systemctl enable spamassassin.service
systemctl start spamassassin.service
But what more do I need to do?
Lars Poulsen
(357 rep)
Feb 11, 2025, 12:08 AM
10
votes
1
answers
7573
views
Can I read /var/mail with a GUI?
I can set up local-only mail accounts using `sendmail` or `postfix`, and messages will be stored in `/var/mail/USERNAME` and readable in a terminal window using `mutt`. I tried setting up a couple of MUA GUIs to read from this mailbox, but they all expect SMTP or IMAP details. (Tried Evolution, Gear...
I can set up local-only mail accounts using
sendmail
or postfix
, and messages will be stored in /var/mail/USERNAME
and readable in a terminal window using mutt
.
I tried setting up a couple of MUA GUIs to read from this mailbox, but they all expect SMTP or IMAP details. (Tried Evolution, Geary and Thunderbird.) Is there any way to access a local mailbox with a GUI, without having to configure a local SMTP or IMAP server? I don't mind using a dedicated GUI.
lofidevops
(3349 rep)
Feb 28, 2018, 09:03 AM
• Last activity: Jan 29, 2025, 01:37 PM
0
votes
1
answers
58
views
FREEBSD Outgoing Mail Issue - Dual Domain Extension (.com.com)
For a long time, over 6 years, my server was doing well. All moved along nicely without a hitch. Yet, when I tried to use VULTR.com's "snapshot" feature to create an identical server from this long-standing server. Meaning, exact same file system, layout and OS, but on a different IP. It would seem...
For a long time, over 6 years, my server was doing well. All moved along nicely without a hitch. Yet, when I tried to use VULTR.com's "snapshot" feature to create an identical server from this long-standing server. Meaning, exact same file system, layout and OS, but on a different IP.
It would seem my original server, which has been up for so long, was changed in the process of creating a snapshot of it, or indeed forking it over unto a new server instance. Now. I have two .com.com on outgoing email messages from my long-standing server, as reported by spam checkers on the Internet.
Now, instead of domainname.com on outgoing emails, my SPAMHAUS check shows my emails being sent from domainname.com.com (two .com).
Question: Where can I look to see how I can mitigate or outright fix this two domain extension (.com.com) issue?
I've since killed the new forked server, even if it was on an entirely different IP address. Yet, the issue hasn't abated.
I've checked various settings, and even tried setting /etc/mail/mailertable to no avail.
Any clues would be great. Thanks, guys!
Glad to be back here, again, been a long time.
Information from the system:
# uname -a
# hostname
# cat /etc/rc.conf
# cat /etc/mailer.conf | grep sendmail
# ls /etc/mail/*.mc
# cat /etc/mail/*.mc
(in reality
sendmail.mc
is the most interesting one)
DoctorLouie
(101 rep)
Jan 21, 2025, 06:10 AM
• Last activity: Jan 23, 2025, 01:59 PM
0
votes
0
answers
41
views
How to set up email on Intranet - no ISP, no internet, no encryption, no spam filters; everything behind my firewall
The situation is a Raspberry Pi which is hosting several services. Sometimes, a service may fail, then I need to send an alert to my desktop. I have done many web searches, most of the results talk about connecting to an external email service, so are not relevant to me. The desktop has Linux Mint 2...
The situation is a Raspberry Pi which is hosting several services. Sometimes, a service may fail, then I need to send an alert to my desktop.
I have done many web searches, most of the results talk about connecting to an external email service, so are not relevant to me.
The desktop has Linux Mint 22. Mail and postfix seem to be already installed. There is a log file (
/var/log/mail.log
) which only has start-up messages.
The Pi (3B with Raspian 12 bookworm) is headless. I have installed sendmail, ssmtp and postfix. I cannot find a mail log file. I have found files /var/mail/NAME
(where NAME can be the sender [the Pi user] or the receiver [the Mint user]). The contents seem to show that the test messages were processed correctly, but I did once see
Diagnostic-Code: X-Postfix; delivery via local: delivers to command: procmail -a "$EXTENSION"
.
I get no error when running this on the Pi
sendmail -v ME@MYMINT
It simply says
Mail Delivery Status Report will be mailed to [user]. mailq
shows nothing.
On the Pi, the file '/etc/postfix/main.cf' contains
smtpd_banner = $myhostname ESMTP $mail_name (Raspbian)
biff = no
append_dot_mydomain = no
readme_directory = no
compatibility_level = 3.6
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level=maysmtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = MYPI.MYDOMAIN.org
myorigin = MYPI
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, MAIL@MYDOMAIN.org, localhost.localdomain, localhost, MYMINT.MYDOMAIN.org
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.1.0/28
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
MYDOMAIN is a made-up name that is only used for this project. MYPI and MYMINT are the host names of my boxes, with IP addresses in the range 192.168.1.x .
Can you help me set up email between these 2 boxes. I think I also need help in reading mail on the Pi.
**Edit - Firewall considerations**
I have tried to eliminate any firewall issues. I have opened port 25 on the Mint box. There is no firewall on the Pi.
Peter Bill
(526 rep)
Jan 13, 2025, 07:46 PM
• Last activity: Jan 14, 2025, 10:31 AM
0
votes
0
answers
23
views
Configure sendmail on 2 Linux redhat machine, one for generate mail, second to transmit to a relay
* An old linux machine A contains an application, that test hardware and sends report by email by using SendMail. The email are send to a relay at the headquarter (I don't have access). * A new linux machine B also make the same, and sends reports to the same relay. After the relay, the emails are s...
* An old linux machine A contains an application, that test hardware and sends report by email by using SendMail. The email are send to a relay at the headquarter (I don't have access).
* A new linux machine B also make the same, and sends reports to the same relay.
After the relay, the emails are sent to people internally, or suppliers externaly, ...
The headquarter changes the relay to a new one. The machine B can still send email to the new relay. But the machine A cannot because TLS is too old and cannot talk to the new relay.
Month after month all applications are transferred to B, but it will take 2 or 3 years.
* Try1:install new TLS on old A... No, it doesn't work, too old generation.
* Try2:sendmail A sends the results to B. And B sends its own email and also the emails from A.
Question : how to configure SendMail on machines A and B to do this ?
It seems no too complex, but there are no many parameters.. Today the only parameters are "local domain".
Thanks for every useful start of solution :)
J-Michel
JMi49
(1 rep)
Oct 8, 2024, 04:25 PM
• Last activity: Oct 8, 2024, 06:40 PM
7
votes
2
answers
57623
views
Using port 587 with sendmail
I have been using sendmail to send out mails using internally available mail server. But currently port 25 is blocked for security reasons. I would like to know if there is a way to specify port number in the sendmail utility. I am trying to make use of the secure SMTP-MSA port 587 as an alternative...
I have been using sendmail to send out mails using internally available mail server. But currently port 25 is blocked for security reasons.
I would like to know if there is a way to specify port number in the sendmail utility. I am trying to make use of the secure SMTP-MSA port 587 as an alternative assuming I could get that port opened up.
I was not able to find anything in the man pages for sendmail. Is there any alternate utility that could do this?
thinkster
(215 rep)
May 30, 2014, 01:40 PM
• Last activity: Sep 24, 2024, 08:38 AM
0
votes
1
answers
2172
views
Saved message in /usr/rp//dead.letter when sending e-mail on CentOS
We just changed a server from RHEL to CentOS. We have some scripts which run some reports and e-mail them. The part that does the e-mailing is below. function email_report { ( echo "Report attached."; uuencode report.csv report.csv ) | mail -s "Report" john.doe@example.com -- -f noreply@example.com...
We just changed a server from RHEL to CentOS. We have some scripts which run some reports and e-mail them. The part that does the e-mailing is below.
function email_report
{
( echo "Report attached."; uuencode report.csv report.csv ) |
mail -s "Report" john.doe@example.com -- -f noreply@example.com
}
but the reports aren't received and we see this message:
> /usr/rp/dead.letter... Saved message in /usr/rp//dead.letter
Does anyone know how to solve this? It is just this script which is causing that message. Other scripts that send e-mail don't have an issue.
Contents of
dead.letter
:
From rp Fri Oct 7 11:56:02 2016
Return-Path:
Received: (from rp@localhost)
by EXAMPLESERVER.localdomain (8.14.4/8.14.4/Submit) id u97Au2No020739;
Fri, 7 Oct 2016 11:56:02 +0100
From: rp
Message-Id:
Date: Fri, 07 Oct 2016 11:56:02 +0100
To: noreply@example.com, -f, --, john.doe@example.com
Subject: Report
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Report attached.
begin 664 OSWHMFHXSF.csv
M15)23U(Z"D]202TQ,C$U-#H@5$Y3.F-O=6QD(&YO="!R97-O;'9E('1H92!C
M;VYN96-T(&ED96YT:69I97(@U-94T1"07Q365-/4$52?5T*=VAE&ET:6YG(%-13"I0;'5S"@``
`
end
user6888062
(151 rep)
Oct 7, 2016, 10:11 AM
• Last activity: Sep 15, 2024, 01:07 AM
0
votes
1
answers
272
views
mailx not sending to Outlook distribution list?
So I have a Solaris 11 server with mailx. I am trying to send emails to distribution lists in the company's Outlook (which is not running on this server, it runs on Microsoft's cloud). I am able to send emails to individuals without trouble. Then I am able to send emails to SOME distribution lists,...
So I have a Solaris 11 server with mailx. I am trying to send emails to distribution lists in the company's Outlook (which is not running on this server, it runs on Microsoft's cloud). I am able to send emails to individuals without trouble. Then I am able to send emails to SOME distribution lists, but not others. A coworker of mine who has been here a long time told me there was "some setting in Outlook" that allows mailx to send to distribution lists. Other people have told me I need to set up an alias file (I've checked the alias file on the server, it is empty, so that does not explain why some distribution lists are working but not others).
By "not working" I mean just that- the emails don't send. They appear in /var/log/syslog without errors. But the emails are never received.
I'm at a loss as to what to do. Any help at all is appreciated.
bk_32
(111 rep)
Aug 1, 2024, 02:46 PM
• Last activity: Aug 1, 2024, 05:24 PM
0
votes
1
answers
236
views
How to set absolute postfix Maildir NOT within home directory ? mail_spool_directory does not work
I have installed Postfix from source in the top level directory `/srv/mail/`. I edit the `main.cf` file and add: ``` home_mailbox = mail/ ``` When I then send a mail with: ``` sendmail -t localuser@localhost > My message here > . ``` The mail arrives in: ``` /home/localuser/mail/new/ ``` Great. I no...
I have installed Postfix from source in the top level directory
/srv/mail/
.
I edit the main.cf
file and add:
home_mailbox = mail/
When I then send a mail with:
sendmail -t localuser@localhost
> My message here
> .
The mail arrives in:
/home/localuser/mail/new/
Great. I now want to have the mail arrive in another directory **NOT** the home directory. For example, I would like the mail for user $userName to be sent to:
/path/to/mail/$userName/mail/
In the postfix default main.cf
file, the variable mail_spool_directory
is listed as:
# The mail_spool_directory parameter specifies the directory where
# UNIX-style mailboxes are kept. The default setting depends on the
# system type.
Originally, I thought this would mean I could set an absolute path under which to store mail. I set:
mail_spool_directory = /var/mail
which I thought, for mail sent to $userName@localhost
, would store the mail under:
/var/mail/new/
Alas, this does not work. I still receive mail under the users home directory. The same outcome when the mail_spool_directory
was commented.
I have searched online but to no avail. I have tried setting permissions of var/mail
to 777
. This has no effect on the outcome.
Some other posts I found which have not fixed the issue:
1) https://unix.stackexchange.com/questions/34233/how-to-create-maildir-directory-with-enough-permissions-for-postfix
2) https://unix.stackexchange.com/questions/738855/home-user-directory-permissions-being-set-to-777
3) https://unix.stackexchange.com/questions/418146/postfix-and-dovecot-use-root-maildir-instead-of-var-spool-mail
What am I not understanding about the setup of the postfix mail directory and meaning of mail_spool_dir
?
According to an article I found online, I also attempted using the variable:
$user
within the postfix main.cf
but postfix complained the variable was not set.
UPDATE
------
On the page: http://www.postfix.org/postconf.5.html#mailbox_transport , under mailbox_transport
, it states:
"
Optional message delivery transport that the local(8) delivery agent should use for mailbox delivery to all local recipients, whether or not they are found in the UNIX passwd database.
The precedence of local(8) delivery features from high to low is: aliases, .forward files, mailbox_transport_maps, mailbox_transport, mailbox_command_maps, mailbox_command, home_mailbox, mail_spool_directory, fallback_transport_maps, fallback_transport and luser_relay.
"
So perhaps mail_spool_directory
is being ignored due to a higher priority directive ? Any guidance is greatly appreciated.
user10709800
(73 rep)
Jun 22, 2024, 05:16 PM
• Last activity: Jun 22, 2024, 07:13 PM
Showing page 1 of 20 total questions