date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,469,693,791,000 |
I want to reject email from certain senders (ie, the MAIL FROM sender) whose domain appears in a type:table map if the transport is not via STARTTLS. So if [email protected] sends an email then I want it to reject unless it us running within STARTTLS, but the rest of the internet can still send non-TLS email if they would like. (For outbound TLS validation smtp_tls_policy_maps works...and I want inbound, too.)
It looks like smtpd_sender_restrictions is the right place to check details about the inbound email's sender but I don't see any TLS-specific options. (Note that I am not looking for client-side certificates, just sender validation claimed by the MAIL FROM command.)
Can postfix be configured to require TLS based on the sender address?
If not, can you contrive a way to filter by FROM address to make sure they send via TLS?
|
This is perhaps possible via "Postfix SMTP Access Policy Delegation"
with Postfix version 2.3 or later; a daemon would check that the
encryption_protocol sufficies (exists?) for sender whose domain
belongs to to some list (or is in some database table, if there are a
lot of them).
(A milter interface, if the TLS information is passed along, could
also make an accept/reject decision. So if you are already using
MIMEDefang or similar...)
| Can Postfix require TLS per-domain for inbound _and_ outbound addresses (or IPs)? |
1,469,693,791,000 |
I am in the process of trying to upload around 20 years worth of Usenet archives to archive.org but my first batch got reject because some of the archives contained trojans that are encoded in base64. Since I have around 400GB of files to work with, fixing things manually is out of the question. All of the files are in mbox format which is plain text. My first thought was to find and replace all messages in the mbox file containing "Content-Type: application/x-msdownload". That could be pretty difficult. I'm now thinking that an easier brute force method would be to delete all base64 blocks.
From this question, I see that it's possible to find base64 blocks with grep, but I don't know how to set up the same thing with sed and that's why I'm asking. Thanks!
Edit: what I've tried so far
According to this page, ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ should be the regex needed to find base64 text, but when I try to use that with sed, it doesn't actually work or at least it doesn't do what I expect.
Example:
cat clari.local.california.sfbay.biz.mbox | sed -e '#^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$#d' > clari.local.california.sfbay.biz.mbox.test
clari.local.california.sfbay.biz.mbox.test still contains the base64 text.
|
The mutt mail user agent (MUA) can delete messages from a mailbox by MIME type. You can even script this.
A message that has an encoded attachment can be matched in mutt with the search expression ~M application. This matches any message that contains a MIME type containing the string application, usually indicating that an attachment is encoded (probably in base64). You may obviously use the more specific application/x-msdownload if you wish.
If the mailbox is called messages.mbox, you may delete all the messages in it that have any attachment that contains the string application from the command line like this:
mutt -e 'push <delete-pattern>"~M application"<enter><quit>"y"' -f messages.mbox
Note that this does not ask for any confirmation before deleting the messages from the mailbox (the "y" at the end is the reply to the question from mutt whether to delete the messages or not before quitting). You may instead want to move the messages into a separate mailbox:
mutt -e 'push <tag-pattern>"~M application"<enter><tag-prefix><save-message>bad.mbox<enter>"y"<quit>"y"' -f messages.mbox
This tags all messages that match the given search expression, saves them to the mailbox bad.mbox, and quits after deleting them from the original mailbox.
| Remove all base64 blocks from a file |
1,469,693,791,000 |
I'm using msmtp to deliver system email from an Ubuntu server via an SMTP account.
Can I somehow configure this setup to rewrite all emails to one specific recipient address? If so, how?
Or put differently, I don't want any arbitrary PHP script or otherwise to be able to send email to anybody that is not me. I should be the only person that receives any email generated by any script on the server. All while only using msmtp (not using postfix or some other server).
|
I don't think this is possible with msmtp. From the man page (emphasis mine)
Msmtp transmits mails unaltered to the SMTP server, with the
following exceptions:
The Bcc header(s) will be removed. This behavior can be changed with the remove_bcc_headers command and --remove-bcc-headers
option.
A From header will be added if the mail does not have one. This can be changed with the set_from_header command and --set-from-header
option. The header will use the envelope from address and optionally
a full name set with the -F option.
A Date header will be added if the mail does not have one. This can be changed with the set_date_header command and --set-date-header
option.
When undisclosed_recipients is set, the original To, Cc, and Bcc headers are removed and replaced with "To: undisclosed-recipients:;".
The undisclosed_recipients features was added recently. It does not appear to alter delivery though.
If you only cared about all local addresses being sent to a specific recipient (e.g. [email protected]) then you could use the aliases option with file contents
default: [email protected]
| Can msmtp rewrite *all* recipient addresses? |
1,469,693,791,000 |
OS = debian stretch mate desktop with
claws-mail --version
Claws Mail version 3.14.1
Is there a way to create an account for system mails so I can get them in claws-mail (like for apt-listchanges) over exim4?
|
Check /etc/aliases file.
In standard configuration
email to all system accounts is redirected to root
emai to root is redirected to non privileged OS account.
| claws mail how to get system mails over exim4 |
1,469,693,791,000 |
I am running
/usr/sbin/logwatch
and it prints it output to stdout. Why if MailTo parameter is set in config file.
If I do
/usr/sbin/logwatch --mailto MYEMAIL
it works, but why? What is the purpose of MailTo config parameter then?
|
The purpose that MailTo parameter is set on the configuration file is to serve for the daemon itself, for example to send log reports periodically.
| How to run logwatch and tell to email me manually? |
1,469,693,791,000 |
I’m stuck on a basic dns issue here "I think". I can send email but unable to receive.
What I want to achieve is host webfiles of my webpage on 184.69.151.38 and use smtp ip from
193.47.34.77.
I think my A records might be wrong.
What is happening is mxtoolbox is picking up as the email server as 184.69.151.38 but the smtp is supposed to be sending from 193.47.34.77. Likely dns issue. I'm just not seeing it.
Yet smtp test looks decent, not perfect but should work.
|
When you tell mxtoolbox to "Test Email Server" named jessemacdougall.com, it does exactly what you told it to do. You're not testing "the mail server of domain jessemacdougall.com" - you are testing whether server jessemacdougall.com can successfully receive mail. And if you use the "DNS Lookup" function, the only actually published A record for that name is 184.69.151.38.
I'm guessing that the A record with a Name of just . and a Value of 193.47.34.77 is being rejected by the DNS server as being outside the DNS zone. You probably should delete that record altogether.
(In DNS records, a name that ends in . is supposed to be fully qualified. A name that is only . effectively claims to be one of the root DNS servers of the whole Internet - and you definitely don't want to claim that by accident, hence the sanity check.)
If you want to test the mail reception capabilities of 193.47.34.77, you should use either the IP address or the name magnifies.jessemacdougall.com. This allows the mxtoolbox to be used to test servers before they are placed into full production use (by pointing the domain's MX records at the server).
You are receiving email because there is a MX record telling the world that the name of the server that handles the mail of domain jessemacdougall.com is actually magnifies.jessemacdougall.com:
jessemacdougall.com. 3600 IN MX 10 magnifies.jessemacdougall.com.
Because of this record, mail servers on the internet will know to connect to magnifies.jessemacdougall.com i.e. IP address 193.47.34.77 if they have mail to deliver for you.
The receiving mail server of domain jessemacdougall.com does not have to be named jessemacdougall.com. It might even be in another domain altogether, as long as the MX record is correctly set and the server administrator has configured the server to accept mail addressed to the jessemacdougall.com domain.
There is one special case where the mail server name would need to match the domain name. That is when the domain has no MX records at all. But this is poor practice: a valid receiving mail server should have MX record(s) pointing to it. This leaves the A record corresponding to the domain name free for other purposes: in most cases (like yours) it is used for a web server.
In order to clear the "SMTP Banner Check", the email software on 193.47.34.77 would need to state its name as magnifies.jessemacdougall.com in the SMTP Banner. In most cases, this means configuring that name as the canonical hostname in the SMTP software on that host.
Your problems with outgoing email might be caused by your SPF record. When looking up published DNS records of type TXT for your domain, I can currently see:
jessemacdougall.com. 1021 IN TXT "v=spf1 -all"
jessemacdougall.com. 1021 IN TXT "google-site-verification=U3GFANwgQpWi8WIXsp-zvrb9sqxO5FxW14f5qquz0IU"
The first line is the SPF record. The v=spf1 -all means that any outgoing mail servers not listed in the SPF record should explicitly be considered invalid - but then the record lists no valid outgoing mail servers at all. So effectively, your domain's SPF record is currently saying "this domain will not send any legitimate mail at all: if you see any email claiming to originate from here, it is the result of forgery/malware and should be summarily discarded as spam." No wonder you cannot successfully send anything!
If you want to send outgoing mail to the internet from 193.47.34.77, the value of the SPF record should instead be:
v=spf1 ip4:193.47.34.77 -all
| A Record Configuration: Host Content on Webserver IP and Smtp IP From Another Server |
1,469,693,791,000 |
Hello I want make my website able to do simple function as sending email to any email address I want. I know how to do it in webiste host within my PC and there are plenty instructions, However if i want to do the same thing wihin website host within raspberry pi is there any different? it's pretty hard to find some article talked about. for example if I want use this instruction :https://medium.com/@WebReflection/how-to-send-emails-from-static-websites-9a34ceb9416c is there something i need be carefully?
I already tried simple mailto by html, the code like this:
<form action="mailto:[email protected]" method="post" enctype="text/plain">
Name:<br>
<input type="text" name="name"><br>
E-mail:<br>
<input type="text" name="mail"><br>
Comment:<br>
<input type="text" name="comment" size="50"><br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>
this code is working ok however it only open windows mail and need me retype destination email adddress. I wish after the email address and content is typed, when the send button is clicked. the email can send direcly to detination address.
|
Before I start, a word of caution: Setting this up insecurely not only can, but almost certainly will wind up with your website being used to send a flood of spam until your IP address is banned -- and the way you've phrased your question doesn't suggest you understand the issues enough to avoid this. Whatever you're trying to do, I recommend you find another way.
As to your question...
What you want isn't something a 'static' website can do.
That article you link to and the HTML code you're describing does exactly what it's supposed to -- generate a mailto: event for your browser to handle, which then correctly opens your system's mail client to handle it.
If you want your website to actually send mail, you're going to have to make a dynamic one, using whichever website programming or scripting language you're comfortable with; PHPMailer is a fairly popular choice.
Note that in its default configuration it does no checks whatsoever about the possible legitimacy of the messages it's asked to send, and when while checking my webservers' site logs I routinely find queries from botnets looking for unsecured PHPMailer sites to use to relay their spam. Please be careful.
| Sending email from website hosting within raspberry pi |
1,469,693,791,000 |
Classic email setup:
[REAL-MAIL-SERVER]
[IMAP/POP3 >] ---------> [EMAIL-CLIENT]
[Storage]
Is there any server application (open source) that would permit to store emails and act like a rely/proxy between the client and the mail server ?
[REAL-MAIL-SERVER] [PROXY-RELY-SERVER]
[IMAP/POP3 >] ---------> [< IMAP/POP3 >] ---------> [EMAIL-CLIENT]
[Storage] [Storage]
The purpose here is to keep emails data in a private location out of the main server and access it with a mobile/desktop clients (the email data would be kept at the "PROXY-RELY-SERVER" location only, client would connect to it, SMTP function is not needed). I found piler but i don't know yet if it could work like that.
Otherwise is there any email client that can act like an IMAP server for other clients to fetch emails from it? Or a simple IMAP server that can fetch other mailbox?
|
I assume everything is captured by the 'proxy-rely-server' (as you named it) serving all clients (the easy way) and it's the common client.
You probably need a couple of MRA and MDA installed on your 'proxy-rely-server'.
The MDA will act as POP/IMAP server (for local use + other clients).
The MRA (some kind of special MUA) will fetch emails from the 'real-mail-server' and store them on the MDA.
You have the choice between a lot of systems to achieve this. I just can suggest that, for now, I'm using Dovecot as MDA and Getmail as MRA.
The drawback is that all emails should be erased on the 'real-mail-server' as no syncing is -easily- possible. That means you'll have to take care of backups...
[edit following you comment]
As the 'proxy-rely-server' is NOT the common client, but some kind of server box (I guess), and as I'm a lazy guy, I can suggest you having a look at ISPConfig witch will do everything you need and a lot more. It's stable (based on debian or many other distros), very well documented, easy to install, easy to use, and very easy to maintain.
| Is there any IMAP/POP3 rely and archiving server application? |
1,469,693,791,000 |
I am trying to configure configure sendmail to use a relay. I've tried several procedures, but I don't know why it doesn't work since the same relay is used by other services and it works.
Below is the installation procedure I am using.
What can I do to diagnose what happens? What could be wrong?
Thanks!
Installation and configuration
Run the following to update and install...
yum -y update
yum -y install sendmail-cf
yum -y install m4
yum -y install cyrus-sasl-plain
Create directory for storing authentication files...
mkdir /etc/mail/authinfo
chmod 700 /etc/mail/authinfo
Create a auth file...
TIP: The file may have any name like "smtp-auth".
read -r -d '' FILE_CONTENT << 'HEREDOC'
BEGIN
AuthInfo:smtp.my_domain.com.br "U:root" "I:my_user@my_domain.com.br" "P:my_password"
END
HEREDOC
echo -n "${FILE_CONTENT:6:-3}" > "/etc/mail/authinfo/smtp-auth"
Create a hash map file of above created auth file...
enter code heremakemap hash /etc/mail/authinfo/smtp-auth < /etc/mail/authinfo/smtp-auth
Configure Sendmail with SMART_HOST...
Add following configuration lines into your "sendmail.mc" configuration file immediately before "MAILER(smtp)dnl" line...
vi /etc/mail/sendmail.mc
Content...
define(`SMART_HOST', `smtp.my_domain.com.br')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_OPTIONS', `A p')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo', `hash -o /etc/mail/authinfo/smtp-auth.db')dnl
MASQUERADE_AS(my_domain.com.br)dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(my_domain.com.br)dnl
Re-build sendmail's configuration...
make -C /etc/mail
Enable and start the sendmail service...
systemctl enable sendmail.service
systemctl restart sendmail.service
Test and output
[root@localhost ~]# read -r -d '' EMAIL_CONTENT << 'HEREDOC'
> BEGIN
> From: my_user@my_domain.com.br
> To: recipient@recipient_domain.com
> Subject: Fail2ban test
>
> Fail2ban test
>
> END
> HEREDOC
[root@localhost ~]# echo -n "${EMAIL_CONTENT:6:-3}" | sendmail -Am -d60.5 -v recipient@recipient_domain.com
map_lookup(dequote, root, %0=root) => NOT FOUND (0)
map_lookup(host, recipient_app.com, %0=recipient_app.com) => recipient_app.com. (0)
map_lookup(mailertable, recipient_app.com, %0=recipient_app.com) => NOT FOUND (0)
map_lookup(mailertable, .com, %0=.com, %1=recipient_app, %2=recipient_app) => NOT FOUND (0)
map_lookup(mailertable, ., %0=., %1=recipient_app.com) => NOT FOUND (0)
recipient@recipient_domain.com... Connecting to smtp.my_domain.com.br port 587 via relay...
220 a2-smithers5.uhserver.com ESMTP
>>> EHLO localhost.localdomain
250-a2-smithers5.uhserver.com
250-PIPELINING
250-SIZE 41943040
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN LOGIN PLAIN
250-AUTH=LOGIN PLAIN LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
map_lookup(macro, {TLS_Name}, %0={TLS_Name}, %1=smtp.my_domain.com.br) => (0)
map_lookup(access, TLS_Srv:smtp.my_domain.com.br, %0=TLS_Srv:smtp.my_domain.com.br) => NOT FOUND (0)
map_lookup(access, TLS_Srv:my_domain.com.br, %0=TLS_Srv:my_domain.com.br) => NOT FOUND (0)
map_lookup(access, TLS_Srv:com.br, %0=TLS_Srv:com.br) => NOT FOUND (0)
map_lookup(access, TLS_Srv:br, %0=TLS_Srv:br) => NOT FOUND (0)
map_lookup(access, TLS_Srv:200.147.36.31, %0=TLS_Srv:200.147.36.31) => NOT FOUND (0)
map_lookup(access, TLS_Srv:200.147.36, %0=TLS_Srv:200.147.36) => NOT FOUND (0)
map_lookup(access, TLS_Srv:200.147, %0=TLS_Srv:200.147) => NOT FOUND (0)
map_lookup(access, TLS_Srv:200, %0=TLS_Srv:200) => NOT FOUND (0)
map_lookup(access, TLS_Srv:, %0=TLS_Srv:) => NOT FOUND (0)
map_lookup(authinfo, AuthInfo:smtp.my_domain.com.br, %0=AuthInfo:smtp.my_domain.com.br) => NOT FOUND (0)
map_lookup(authinfo, AuthInfo:200.147.36.31, %0=AuthInfo:200.147.36.31) => NOT FOUND (0)
map_lookup(authinfo, AuthInfo:, %0=AuthInfo:) => "U:my_user@my_domain.com.br" "I:my_user@my_domain.com.br" "P:brlight2012" "M:PLAIN" (0)
>>> AUTH PLAIN YWRtaW5AbGlnaHRiYXNlLmNvbS5icgBhZG1pbkBsaWdodGJhc2UuY29tLmJyAGJybGlnaHQyMDEy
235 2.7.0 Authentication successful
>>> MAIL From:<[email protected]> SIZE=97 [email protected]
550 5.7.1 Envio nao autorizado - Verifique o MX e/ou SPF do seu dominio
map_lookup(dequote, root, %0=root) => NOT FOUND (0)
map_lookup(dequote, root, %0=root) => NOT FOUND (0)
map_lookup(dequote, MAILER-DAEMON, %0=MAILER-DAEMON) => NOT FOUND (0)
map_lookup(host, my_domain.com.br, %0=my_domain.com.br) => my_domain.com.br. (0)
map_lookup(host, recipient_app.com, %0=recipient_app.com) => recipient_app.com. (0)
root... Connecting to local...
root... Sent
Closing connection to smtp.my_domain.com.br
>>> QUIT
NOTE: The "my_user@my_domain.com.br" account is able to send email to the "recipient@recipient_domain.com" account from its webmail.
ERROR: "550 5.7.1 Envio nao autorizado - Verifique o MX e/ou SPF do seu dominio" (portuguese)/"550 5.7.1 Unauthorized sending - Check your domain's MX and/or SPF" (english).
|
The error...
"550 5.7.1 Envio nao autorizado - Verifique o MX e/ou SPF do seu
dominio" (portuguese)/"550 5.7.1 Unauthorized sending - Check your
domain's MX and/or SPF" (english)
... happens because the SMTP service in use by us requires that the "envelope sender" be the same as the effective "sender".
To address this issue we need to build a genericstable database to map the input sender address to the desired address.
In our case, create the file "/etc/mail/genericstable" with the entry root my_user@my_domain.com.br and add the entry FEATURE(genericstable',hash -o /etc/mail/genericstable.db')dnl in the "/etc/mail/sendmail.mc" file.
For a better understanding, below is the complete procedure.
Sendmail - Installation and configuration
Run the following to update and install dependencies...
yum -y update
yum -y install sendmail-cf
yum -y install m4
yum -y install cyrus-sasl-plain
Create an auth file...
read -r -d '' FILE_CONTENT << 'HEREDOC'
BEGIN
AuthInfo:smtp.my_domain.com.br "U:root" "I:my_user@my_domain.com.br" "P:my_password"
END
HEREDOC
echo -n "${FILE_CONTENT:6:-3}" > "/etc/mail/authinfo"
Building a "genericstable" database to map the input sender address to the desired address ("envelope sender").
Create the "genericstable" file...
read -r -d '' FILE_CONTENT << 'HEREDOC'
BEGIN
root my_user@my_domain.com.br
END
HEREDOC
echo -n "${FILE_CONTENT:6:-3}" > "/etc/mail/genericstable"
Configure Sendmail with "SMART_HOST".
Add following configuration lines into your "sendmail.mc" configuration file immediately before "MAILER(smtp)dnl" line...
vi /etc/mail/sendmail.mc
Content...
define(`SMART_HOST', `smtp.my_domain.com.br')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_OPTIONS', `A p')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`authinfo', `hash -o /etc/mail/authinfo/smtp-auth.db')dnl
MASQUERADE_AS(my_domain.com.br)dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(my_domain.com.br)dnl
FEATURE(`genericstable',`hash -o /etc/mail/genericstable.db')dnl
Re-build sendmail's configuration...
make -C /etc/mail
Enable and start the sendmail service...
systemctl enable sendmail.service
systemctl restart sendmail.service
Test your configuration
read -r -d '' EMAIL_CONTENT << 'HEREDOC'
BEGIN
From: my_user@my_domain.com.br
To: recipient@recipient_domain.com
Subject: Fail2ban test
Fail2ban test
END
HEREDOC
echo -n "${EMAIL_CONTENT:6:-3}" | sendmail -Am -d60.5 -v recipient@recipient_domain.com
[Refs.: http://blog.achinthagunasekara.com/2015/08/how-to-configure-sendmail-to-work-with.html , https://access.redhat.com/discussions/2959431 , https://docs.cloud.oracle.com/iaas/Content/Email/Reference/sendmail.htm , https://serverfault.com/a/574118/276753 , https://serverfault.com/a/839476/276753 , https://superuser.com/a/1448009/195840 , https://tecadmin.net/sendmail-to-relay-emails-through-gmail-stmp/ , https://www.bonusbits.com/wiki/HowTo:Configure_SendMail_to_Use_SMTP_Relay , https://www.sitepoint.com/community/t/email-mx-records-vs-spf-records/7947 ]
Further question/Plus: Why use Sendmail with relay?
The biggest problem with sendmail is that a lot of spammers like to
use it to blast out emails without needing a domain name, so it gets
rejected frequently. If you have a SMTP you can relay through that
will help matters a bit.
[Ref.: https://support.nagios.com/forum/viewtopic.php?f=7&t=28246 ]
| sendmail - sendmail using relay (Why it doesn't work?) |
1,469,693,791,000 |
I'm trying to:
Attach multiple files into one email.
Have the email sent out using a Gmail account with the current date and time in the subject header.
I'm having trouble with the for a loop since I don't want to create multiple emails I just one to create one email with all the attachments included and have the current date and time used in the subject line.
#!/bin/bash
# to run type "bash email_live_listing.sh"
dt_now_start=`date +"%Y-%m-%d %T"`
fn_dt_now_start=`date '+%Y_%m_%d__%H_%M_%S'`; #use to generate file name with date
currentdir="$(pwd)" #get current directory
ls $currentdir/us*.pdf -tp | grep -v '/$fn_pdf' #place files into variable
echo "$fn_pdf"
ITER=0
for t in ${fn_pdf[@]}; do
swaks --to [email protected] -s smtp.gmail.com:587 -tls -au [email protected] -ap password --header "Subject: Updated file ${fn_dt_now_start}" --body "Email Text" --attach-type ./${fn_pdf} -S 2
let ITER+=1 #increment number
done
Ps: I'm using Ubuntu and Swaks since it's compact and lightweight, and will be run from a raspberry pi, but I'm willing to try other options.
|
Here's a bash script that might help others out that I got to work.
#!/bin/bash
currentdir="$(pwd)" #get current directory
fn_dt_now_start=`date '+%Y_%m_%d__%H_%M_%S'`; #use to generate date time
fn_txt=$(ls $currentdir/*.txt) #place txt files found into a variable
for t in ${fn_txt[@]}; do
attach_files="${attach_files} --attach-type ${t}" #will build list of files to attach
done
swaks --to [email protected] -s smtp.gmail.com:587 -tls -au [email protected] -ap <email_sending_from_password>] --header "Subject: Listings - ${fn_dt_now_start}" --body "Listings Email Text" ${attach_files} -S 2
| Attaching multiple files using bash and emailing it out using SWAKS or another program |
1,469,693,791,000 |
I've recently configured new .procmailrc and .forward files to work with our Postfix mail server. I've tested it with new Emails, and the new .procmailrc is properly filtering and forwarding as desired.
Now I would like to somehow re-process the entire contents of my /var/spool/mail/***username*** file using the new .procmailrc so that all 2000+ messages will be properly sorted into my new ~/mail/Likely-Spam, ~/mail/Almost-Certainly-Spam, ~/mail/Cron-Jobs, ~/mail/Email-Backup, etc..., and forward all non-filtered messages to my company outlook account... for posterity.
Is there a straightforward command to accomplish this?
My mail server is running RHEL 7 with postfix.
|
procmail comes with another program called formail which can be used to process an existing mbox. You can use that to pipe your mailbox back into procmail.
To avoid race-conditions with newly arriving mail, I'd rename the spool mbox before processing it. For example:
mv /var/spool/mail/username /var/spool/mail/username.orig
formail -s procmail < /var/spool/mail/username.orig
rm /var/spool/mail/username.orig
any arguments and options after -s procmail will be passed on to procmail.
From the formail man page:
-s
The input will be split up into separate mail messages, and piped
into a program one by one (a new program is started for every
part).
-s has to be the last option specified, the first argument
following it is expected to be the name of a program, any other
arguments will be passed along to it.
If you omit the program,
then formail will simply concatenate the split mails on stdout
again.
see man formail and man procmail for more details.
| Invoke procmail on spool file using new .procmailrc? |
1,469,693,791,000 |
Mails from my account are fetched using the POP3 protocol using the mutt email client.
Will it is desired that mutt downloads the (new) mails (for having them available offline), those mails shall not be deleted from the mailserver, for the simple reason that I fetch my mail using two different machines and having it downloaded and then deleted makes it impossible to have all mails available on all machines.
The trouble to the configuration, and the core of the question is the following. Telling mutt to not delete the mails from the server after the download, currently leads to duplicates and increasingly long duplicate download of the mails.
Is there a way to configure mutt, so as to keep mails stored on the server, but not to download those mails again which exists already form previous mail fetches?
I remember that other email clients, could perform such a task making me think it is not an inherent limitation of the POP3 protocol.
|
POP3 isn’t ideally suited for this kind of usage, IMAP would be much better. However, if your POP3 server supported the necessary commands, Mutt can be configured to keep mail on the server and only download new messages:
unset pop_delete
will tell Mutt to keep messages on the server, and
set pop_last
will tell Mutt to use the LAST POP3 command to only retrieve unaccessed messages from the server. (See RFC 1460 for details of the LAST command, which was deemed hard to implement correctly and removed from subsequent POP3 RFCs.)
| Tell mutt email client to leave mails on server and _not_ download them again next time? |
1,469,693,791,000 |
I would like to purchase a VPS and a domain to run my Rails web application on Ubuntu 18.04 LTS. I will send transactional emails using Sendinblue to allow users to activate their account.
With regard to server administration, I planned to install services like Fail2ban, OSSEC and rkhunter and configure them to send notifications via email, however I still have to understand how to do it. My first idea was to create an email account at one of the free online services like Yahoo mail, Outlook or Gmail but I was told that, without sending those mails via authenticated SMTP, I would probably be blackholed. I need Fail2ban, OSSEC and rkhunter to send their notifications, so I need to use an email service to only receive and consult those emails, being sure they are not blackholed. What would you suggest? I considered the opportunity to install Sendmail or Postfix and configure them to receive only by the local machine, but at Reddit I was advised to look for alternative solutions.
|
I don't know Sendinblue, but in general you'd be blackholed only if you set up your own mail service without necessary certificates. If you use an outer mail account, the things go smoother. If your post sender is able to log into the outer mail service (e.g. Gmail), then you don't need any local mail service. As for the general system mail, take a look at this:
Can I set up system mail to use an external SMTP server?
| Receiving emails from local services |
1,469,693,791,000 |
I'm new to bash scripting and I've read tons of manuals for programs like mutt, procmail, ripmime, and such and still have no clue how to this script or even use these programms properly.
If someone could help me out with that, that'd be great.
|
If you want to download mail (e.g. from a remote imap or pop mail server), you need to use a program such as fetchmail or getmail. Both of these are available as packages for Ubuntu, so can be installed with apt.
These programs can be configured to connect to your remote mail server(s), authenticate with your username and password, download mail and either store it in a specified directory, or pipe it into an external program such as procmail for further processing.
As for the programs you mentioned:
mutt is a full-featured mail client or Mail User Agent (MUA). It can be configured to connect to a remote pop or imap mail server (allowing you to read and send mail, or save specific messages to local storage), but isn't really suitable for automated mail download & processing.
procmail is a Mail Delivery Agent (MDA). It is used to deliver mail to particular files, directories, or even forward them to other email addresses depending on matching rules in a .procmailrc file.
procmail is mostly used with Mail Transfer Agents (like postfix or exim or sendmail etc) but is often used with programs like fetchmail - fetchmail does the fetching, and procmail rules examine the headers and/or the body of each message to decide whether to save each message to a file, pipe it to one or more other programs (e.g. ripmime), and/or forward it to another address.
ripmime is a tool used to extract MIME attachments from a message you have already read. you can use it on files containing saved messages, or pipe messages to it from an MUA like mutt.
| Creating bash script for auto-mailfetching and extraction to a specific location |
1,469,693,791,000 |
I need to understand how postgrey keeps track of inbound mail. I know the concept of how greylisting works, but I'm wondering about the actual method. Greylisting will count the number of times a mail server has sent through a message succesfully over a given period of time and if it reaches the desired threshold, it will become a known mail host for X amount of time.
I understand that.
But if a specific mail comes in for the first time, from an unknown mail host, how does postgrey keep track of this individual message - i.e. when it comes back from a compliant server the second time, how does postgrey know it was a "deferred" mail?
|
Summarising the behaviour: the check is made against IP address+sender+receiver.
The connection states are kept in a Berkeley DB.
When connection arrives:
if it part of a defined whitelist it is accepted;
if not in the DB, it is added to the DB and the connection is rejected;
if in the DB:
if it is the first retrial it is beyond the retry_window, it is discared from the DB;
if it is in the defined retry_window, the connection will then be accepted.
From Greylisting to avoid spam
The triplet of ip address, sender and receiver will now be stored to
the database of postgrey as “known sender” and further mails from the
same address should by delivered immediately without any delay.
Since the most spammers don’t to this – try the delivery a second time
– most spam mails will just be ignored.
From posgrey source comments
find out if the last time was unsuccessful, so that we can add a
header to say how much had to be waited.
....
discard stored first-seen
if it is the first retrial and it is beyond the retry_window.
| How does postgrey track inbound mail |
1,557,493,455,000 |
I installed Roundcube on a Debian server running Dovecot, Postfix, mySQL for mail, and postfixadmin.
Then I installed Roundcube.
I have another server with the same configuration.
I can send and receive using IMAP/SMTP with Thunderbird. But when I connect using the Roundcube client I get the error:
Connection to storage server failed.
What process should I use to diagnose this?
|
Roundcube uses IMAP to interact with the mailstore, check that the server running roundcube can connect to the server running IMAP (this is probably localhost)
Possibly the IMAP server is not available on localhost (::1) but is on "ipv4 localhost" aka 127.0.0.1
| Roundcube Error: Connection to storage server failed |
1,557,493,455,000 |
I have some cron tasks, and some of them doesn't stop sending me emails.
An example task are:
*/2 * * * * php app/console mautic:email:fetch > /dev/null 2>&1
(All the tasks with the problem are mautic tasks).
I've tried some tricks for avoiding emails:
> /dev/null
>/dev/null
>/dev/null 2>&1
>/dev/null 2>&1 || true
|| true
All of them continues to send mails each run.
An example email:
/bin/sh: 1: cannot create 1: Permission denied
(I understand that's a strange error, but it's a example. I know I need to solve the error and not silence it, but I want to know why I cannot silence it with a normal method).
The question are: Why even when I redirecting the task result, or when using the || true to change the task result, cron continues sending emails? The only solution I can find (on the linked question), are to add
MAILTO=""
after the "normal" (or not-spamming) cron tasks (and before these other ones).
Related question:How do I completely silence a cronjob to /dev/null/?.
|
The /bin/sh: 1: cannot create 1: Permission denied error is probably because you have a typo in a redirection. Perhaps instead of 2>&1 you have 2>1 or 2>1&. (Normally the attempt to create a file named 1 in your home directory would succeed, but if a file named 1 already exists and is not writable then you'll get that error.)
The reason why that error isn't silenced is that the message is not coming from the command whose output has been redirected. The message is being reported by the shell during the time it is trying to set up redirection for the command. Output from the shell itself has not been redirected, so the message is collected by cron and emailed to you.
| Why cron doesn't stop sending emails even redirecting to /dev/null |
1,557,493,455,000 |
I've currently got Neo/Mutt configured alongside iSync for a few different accounts. Everything syncs up and I've got the Mutt client configured roughly how I want it. However, I run into issues when using <save-message> to move a message to an Archive folder. It's different depending on the type of account:
In my two Gmail accounts, if I read a message and then <save-message> to my local "All Mail" folder, the message is moved as expected. Then, when I run mbsync, my All Mail folder in Mutt shows two copies of the same message, with one marked for deletion. They are also both marked as unread, even though I had read the message before moving it. My workaround has been to just delete messages from my inbox. On the following sync, the deleted messages appear in All Mail without duplicates (but still annoyingly marked as unread).
In my ProtonMail account, I can read and then save a message to my Archive folder. On the next sync, I have a duplicate message in the Archive folder, one marked as unread and the other as read, and neither is marked for deletion. Unlike in the Gmail accounts, deleting a message from my inbox does not result in the message showing up in my Archive, so that half-measure doesn't work here.
So maybe it's two separate issues but they certainly seem related. I've read multiple blog posts and scoured many dotfiles. I've seen "solutions" to the duplicate message problem such as folder hooks which delete duplicates when you enter the folder. These are not real solutions, IMO.
So I'm wondering if it's possible to tell Mutt to save a message to a remote folder, and if this would give better results. At the same time, I haven't configured Mutt for IMAP and would prefer that Mutt does no IMAP syncing, leaving that job to mbsync. I still want to use Mutt mainly to read mail that is stored locally, but I also want to teach it to move messages to remote IMAP folders.
Is this possible? Or is there a more obvious approach that I'm overlooking? In the meantime, I'm just manually marking archived messages as read, and deleting duplicates. If I could solve this problem, Mutt will be my favorite email reader by far.
|
I figured out how to get this working with the ProtonMail account. It turns out it is possible to save-message directly to an IMAP directory. However, while mbsync was interfacing with the ProtonMail Bridge's IMAP just fine, NeoMutt would get stuck on "Logging in..."
While trying to debug the overall issue, I had a look at mbsync's log. It didn't help me much to figure out why messages were getting duplicated, but I did notice it was using the LOGIN IMAP authentication method. So I added this line to my NeoMutt config:
set imap_authenticators = "login"
That, along with the following macro, allows me to move the current message or tagged messages directly to the IMAP Archive mailbox, and I no longer get duplicates:
macro index,pager A ":set confirmappend=no\n<tag-prefix><save-message>imap://127.0.0.1:1143/Archive\n:set confirmappend=yes\n"
There is still a small issue in that if the message is both marked as read and moved to Archive in the same mbsync run, the message will still appear as unread. I'm sure there must be some mbsync configuration I'm missing to solve this, but for now I will probably just change my macro to do something like this:
Sync NeoMutt ($ by default), then run mbsync, ensuring the un/read states of all messages have been synced with IMAP.
Then actually run save-message.
Repeat step 1.
This will be a bit slow, but if I'm tagging a bunch of messages first then hopefully it won't be too bad. Good Enough For Now™.
Regarding Gmail, I've decided to just forward all my Gmail that hasn't yet been moved to ProtonMail and let the account die. I still have a Gmail work account, but it doesn't get nearly as much use. A similar approach may well work there, and if I get annoyed enough maybe I'll give it a shot and update this answer with whether it worked.
| Mixing local and remote IMAP folders in Neo/Mutt and iSync? |
1,557,493,455,000 |
The /var/spool/mail/root file was deleted by accident; I need to recover it.
Is there any link related to this file or how this file got updated which script responsible for it?
|
The file /var/spool/mail/root typically contains locally delivered email for the root user. For example,
echo hello, world | mail -s 'kandr test' root
If you don't have a backup then you have lost your local email for this user account. (If you didn't ever read it then consider it a safe loss.)
Don't try to recreate the file. It will be recreated automatically the next time the root user account receives a message. (You can read such messages with the mail or mailx command.)
| /var/spool/mail/root file deleted by accident |
1,557,493,455,000 |
When I install Postfix as a mail server to transfer emails from my Content Management System's contact-forms, into my Gmail account, I choose the option internet-site. After I choose that option Postfix asks me to insert the domain of my site.
But what I have 2 or more sites instead just one? What domain should I insert then?
I don't assume the creators of Postfix expect users to enter a long list of domains separated by commas.
Thanks,
|
The list of choices is not a standard Postfix feature; it's probably the result of the package management system of your Linux distribution. Perhaps Ubuntu, or some other Debian-related distribution?
If I'm correct, you should treat the option dialog as an "easy first installation wizard" only. For a non-trivial configuration, the "training wheels" will have to come off: you'd use the postconf command to further adjust the configuration, or perhaps stop Postfix and then replace the default configuration files with your own customized ones.
| Why does Posfix “limits” me to use only one domain under “internet-site”? |
1,557,493,455,000 |
Do I need port 993 unfiltered to get emails from a WordPress site?
For example, in WordPress I've installed a plugin called "Contact form 7" (CF7) that gives you a basic contact form.
In the plugin settings you can insert your email (say, [email protected]) and messages left in your WordPress CF7 contact form will be forwarded to your private email by this plugin.
I've filtered all port besides 22, 80, 443, 993, and 9000.
Do I really need port 993 unfiltered for the trivial contact form behavior I just described?
|
You most likely won't need it.
Port 993 is related to IMAP, which implies email clients (mutt, thunderbird, ...) connecting to their mailboxes on your server.
Assuming from your question, you're looking to setup a smtp relay, hence do not need to allow in traffic for potential clients - and probably won't have a service listening on these anyway.
| Do I need port 993 to get email in a WordPress site? |
1,557,493,455,000 |
I re-installed a fresh clean Debian 8 on my VPS.
All is set up to default values.
dpkg -s exim4 and dpkg -s postfix says that exim is not installed, and that postfix is installed. This is confirmed by lsof -i :25 which shows a PID 478, then ps p 478 shows 478 ? Ss 0:00 /usr/lib/postfix/master.
I haven't done apt-get install postfix, it seems that it has been installed by default.
I've already done a DNS MX record for example.com by my registrar, directing it my server.
I just sent an email from my Gmail to [email protected].
I still see No mail when doing $ mail.
How to see if something has arrived to postfix?
Is there a configuration to do on a fresh new Debian install to accept emails from internet?
Should I create the mailbox root locally, to accept mail arriving from external mailers to [email protected]?
Here is the result of iptables (unmodified, default configuration):
root@blah:~# iptables -nvL
Chain INPUT (policy ACCEPT 77135 packets, 50M bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 2 packets, 120 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 66416 packets, 11M bytes)
pkts bytes target prot opt in out source destination
I see now in cat /var/log/mail.log this:
Nov 22 11:57:32 blah postfix/smtpd[10485]: connect from mail-ua0-f171.google.com[209.85.xxx.xxx]
Nov 22 11:57:32 blah postfix/smtpd[10485]: NOQUEUE: reject: RCPT from mail-ua0-f171.google.com[209.85.xxx.xxx]: 454 4.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-ua0-f171.google.com>
Nov 22 11:57:32 blah postfix/smtpd[10485]: disconnect from mail-ua0-f171.google.com[209.85.xxx.xxx]
|
This line contains the useful information that you need
Nov 22 11:57:32 blah postfix/smtpd[10485]: NOQUEUE: reject: RCPT from mail-ua0-f171.google.com[209.85.xxx.xxx]: 454 4.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected] ...
What this is telling you is that your machine is refusing to relay a message from Google to [email protected]. Now, you know that your machine is example.com, but clearly your machine doesn't.
Solution: modify the local configuration to include example.com as a name for your local machine. There is an easy-to-read document available on the Postfix website (((BASIC_CONFIGURATION_README.html)[http://www.postfix.org/BASIC_CONFIGURATION_README.html#mydestination]) that explains how to set this up:
My own domain name
The mydomain parameter specifies the parent domain of $myhostname. By
default, it is derived from $myhostname by stripping off the first
part (unless the result would be a top-level domain).
Conversely, if you specify mydomain in main.cf, then Postfix will use
its value to generate a fully-qualified default value for the
myhostname parameter.
Examples (specify only one of the following):
/etc/postfix/main.cf:
mydomain = local.domain
mydomain = virtual.domain (virtual interface)
What domains to receive mail for
The mydestination parameter specifies what domains this machine will
deliver locally, instead of forwarding to another machine. The default
is to receive mail for the machine itself. See the VIRTUAL_README file
for how to configure Postfix for hosted domains.
You can specify zero or more domain names, "/file/name" patterns
and/or "type:table" lookup tables (such as hash:, btree:, nis:, ldap:,
or mysql:), separated by whitespace and/or commas. A "/file/name"
pattern is replaced by its contents; "type:table" requests that a
table lookup is done and merely tests for existence: the lookup result
is ignored.
IMPORTANT: If your machine is a mail server for its entire domain, you
must list $mydomain as well.
Example 1: default setting.
/etc/postfix/main.cf:
mydestination = $myhostname localhost.$mydomain localhost
Example 2: domain-wide mail server.
/etc/postfix/main.cf:
mydestination = $myhostname localhost.$mydomain localhost $mydomain
Example 3: host with multiple DNS A records.
/etc/postfix/main.cf:
mydestination = $myhostname localhost.$mydomain localhost
www.$mydomain ftp.$mydomain
Caution: in order to avoid mail delivery loops, you must list all
hostnames of the machine, including $myhostname, and
localhost.$mydomain.
So, this should be sufficient:
mydomain = example.com
...
mydestination = $myhostname localhost.$mydomain localhost $mydomain
| Receiving email on a fresh new Debian |
1,557,493,455,000 |
I am on ubuntu 16.04.I have sent email to suggest business proposal.What I got in my gmail inbox was something like this
Your message couldn't be delivered to [email protected] because the remote server is misconfigured. See the technical details below for more information.
Then
Final-Recipient: rfc822; [email protected]
Action: failed
Status: 5.0.0
Remote-MTA: dns; mailfilter1.mijndomein.nl. (5b00:4a40:1:1::9:3, the server
for the domain xzy.com.)
Diagnostic-Code: smtp; 550 relay not permitted
Last-Attempt-Date: Tue, 26 Sep 2017 02:31:07 -0700 (PDT)
I have googled and it seems that his server treats my email(gmail) like a spam.How to avoid this?
EDIT
I have emailed my friend, no problem.
I have sent new mail to that guy in Nederlands,again comes [email protected] notification.I can put the original content, but that is a private server.
|
If you try to send email via remote public email server:
I think you have problem with local email client. Perhaps you forget to type login and password and you client try to send email without authentication.
Remote email server think that you are trying to use it as open relay and prevent this action.
If you are using wellknown public server there is nothing wrong with telling us his name. And we can check all needed DNS records
If you try to use some private server:
Possibly this server not yet configured to handling domain which you type in your email address.
| 550 relay not permitted [closed] |
1,557,493,455,000 |
I know you can add the alias of an ID in email server, but is that alias configurable too?
Let's say I have an ID:
[email protected] with
Pass: original pass
I created an alias: [email protected]
Can I configure [email protected] with the Pass of original ID?
Pass: originalpass
|
Aliases don't have passwords - think of them as pointers. When the mail server receives a message for alias@example it will internally look up that it is supposed to be delivered to original@example
The only account that exists is original@example and it is the only one that can be used to authenticate, retrieve mail once authenticated, etc
| Configure email alias |
1,557,493,455,000 |
Postfix is running. I am trying to send maldet report as a mail but it gives me an error I don't know why?
[root@do ~]# maldet --report 170321-0115.21534 [email protected]
Linux Malware Detect v1.6
(C) 2002-2017, R-fx Networks <[email protected]>
(C) 2017, Ryan MacDonald <[email protected]>
This program may be freely redistributed under the terms of the GNU GPL v2
/usr/local/maldetect/internals/functions: line 608: -s: command not found
maldet(18718): {report} report ID 170321-0115.21534 sent to [email protected]
And this is the line 608
if [ -f "$sessdir/session.$rid" ] && [ ! -z "$(echo $2 | grep '\@')" ]; th$
cat $sessdir/session.$rid | $mail -s "$email_subj" "$2"
eout "{report} report ID $rid sent to $2" 1
exit
|
The variable $mail is empty because the command mail is not installed.
Run apt-get install mailx (debian or ubuntu) or yum install -y mailx (centos or redhat)
| Why maldet is not sending report as a mail? |
1,557,493,455,000 |
I can't find any information about the status of IMAP version 4 and how widely it's used nowadays and how widely other versions, 1, 2 and 3 are used.
So is IMAP version 4 common these days? What about other the versions 1, 2 and 3?
|
Restricting this to the commonly used Linux servers:
Courier
Cyrus
Dovecot
They all support IMAP4, since the IMAP4rev1 RFC was defined more than 10 years ago, I don't think you'll find the older version still being used.
| IMAP -- what are the most popular versions used these days? |
1,557,493,455,000 |
Good Day, I'm still new in Linux CLI and I'm using RHEL 6. I'm executing command for sending email via terminal.
$ cat log.txt | mail -s "Logs" [email protected]
Hosted by outlook365
When I try this command, nothing happens. No errors but nothing happens.
Any tips?
Thank you.
|
Check the /var/log/maillog to see the logs related to the email being sent. Are the logs logging any errors?
| Executing command for sendmail not working |
1,557,493,455,000 |
Suppose I have a file BOD which contains lines of text and a file ADDR which contains e-mail addresses.
How can I send the first line of BOD to the first address in ADDR, the second line of BODIES to the second line in ADDR, ... until the last line?
I know that you can send a mail in the shell using
TEXT | mail ADDRESS
but how can you repeat this task for each line?
|
Using the following variables,
text_file="$1"
mail_file="$2"
lines_in_text=$( cat "$text_file" | wc -l )
lines_in_addr=$( cat "$mail_file" | wc -l )
line_num=1
You can write the following routine:
send_mail() {
while [[ "$line_num" -le "$lines_in_text" ]]; do
text_line=$( sed -n "${line_num}p" "$text_file" )
mail_line=$( sed -n "${line_num}p" "$mail_file" )
echo "$text_line" | mail "$mail_line"
line_num=$(( line_num + 1 ))
done
}
send_mail
Then you can use your script as follows:
./script BOD ADDR
Edit: An alternative way of doing this would be reading each of the text and address files into separate arrays, whereby every index contains a line of the respective file, as such:
#!/bin/bash
IFS=$'\n' read -d '' -r -a texts < "$1"
IFS=$'\n' read -d '' -r -a mails < "$2"
send_mail_alternate() {
for (( i = 0; i < "${#texts[@]}"; i++ )); do
echo "${texts[i]}" | mail "${mails[i]}"
done
}
send_mail_alternate
Here, the two arrays created are texts and mails. "${#texts[@]}" represents the total number of lines in array texts, and each line can be accessed by "${texts[i]}" or "${mails[i]}", where i starts from 0 moving up, containing line i+1 of the specified file.
| Send Nth line of text to Nth address in the list |
1,557,493,455,000 |
I followed the following guide on how to setup sendmail to use a remote SMTP server and authenticate: https://www.smtp2go.com/docs/sendmail/
However, sendmail shows that it sends emails out, but debug shows that it connects to localhost and not the remote host.
I execute the following command to send emails:
sendmail -X sendmail_log [email protected] [email protected] < /tmp/email.txt
My host 'host1.com' does only allow emails sent from '[email protected]'.
email.txt:
Subject: Terminal Email Send
Email Content line 1
Email Content line 2
This is where in the log file localhost is used:
07460 <<< Subject: Terminal Email Send
07460 <<<
07460 <<< Email Content line 1
07460 <<< Email Content line 2
07460 <<< [EOF]
07460 === CONNECT [127.0.0.1]
|
Sendmail-8.12+: Non set root uid installation => sending via 127.0.0.1:25
"Sendmail by sendmail.org" before sendmail-8.12 used to be installed as set root uid program. It had used to create endless security problems. Sendmail-8.12 to avoid such security risks passes messages to sendmail daemon running as root and listening at 127.0.0.1:25.
If you want to test you configuration you may execute your test command as root with -Am added to sendmail's command line options.
Sendmail by default uses submit.cf configuration file and sends messages to 127.0.0.1:25. Some command line options (including -Am) make sendmail use sendmail.cf configuration file but (usually) it requires root privileges to run correctly.
https://www.sendmail.com/sm/open_source/security/secure-install/
http://linux.die.net/man/8/sendmail.sendmail
| Cannot make sendmail to use a remote SMTP server [closed] |
1,557,493,455,000 |
Background and Current Situation
I inherited a CentOS 5.7 box running Mailman 2.1.9 housing a series of legacy mailing lists. I've been working on moving these lists to other services like Exchange mailing lists and have simply been aliasing the mailing list on the current mailman box to the new Exchange list which is a great short term fix for getting users to use the new lists.
I'd ultimately like to phase out this box and remove it from production but for a few months at least I'd like to auto-reply to (but not forward) messages sent to the old lists and let clients know that the list is going to be phased out and ideally inform them of the new list address.
The Question
What would be the best way to take messages sent to [email protected] where the current alias in /etc/aliases looks like training: "|/usr/lib/mailman/mail/mailman post training"and reply to the sender with a message? I've read in a number of places that procmail or the vacation package are the best bets but I can't seem to find any guidance on how to adapt these solutions to large numbers of aliases where there aren't actual users behind the alias.
One Caveat is that the lists aren't transitioning one for one (i.e. [email protected] isn't becoming [email protected]) so I can't simply do a blanket redirect or simply update the MX records to point to a new set of mail servers.
Environment Details
Below are some details about the current box and installed packages:
CentOS 5.7
Mailman 2.1.9
Procmail 3.22
Sendmail 8.13.8
Postfix 2.3.3
|
Your question is hazy on the details, and I have a bad feeling you are making the whole thing more complex than it needs to be (do you really need to rename the mailing lists? What is it about Exchange that makes it not worse?) but to attempt to answer your concrete question, you should be able to add a second destination to the alias which runs the responder, then passes the message to Mailman, or forwards to the new list address, or whatever. (Of course, if you just want to send the reply, you don't need the original destination any longer; but it is worth pointing out that this is a possibility.)
training: "|/usr/local/bin/autoreply training", "|/usr/lib/mailman/mail/mailman post training"
where /usr/local/bin/autoreply might look something like
#!/bin/sh
######## WARNING: not properly investigated
vacation -a "$1" -m /etc/vacation.msg -f /etc/vacation -e /etc/vacation
I have not investigated whether it is possible or sensible to run vacation with these options, and it also depends on which user you are running this action as (sendmail?). You need to set things up so that the user who runs this script has write access to the resources the program is trying to use; maybe even create a separate user for this purpose. As a starting point, if you can run vacation -I with the above options as root and then change the owner of the files it creates to the user you want to use for this, you should be all set.
Obviously, if you want to use Procmail instead of vacation, you can pretty much copy and paste the traditional recipe from man procmailex -- because it is made up from simple pieces, it might be easier to adapt to your circumstances if you can't get vacation to work reasonably in this setting.
... Or look into something like http://www.brandonchecketts.com/archives/vacation-autoreply-message-with-virtual-users-and-postfix as a one-stop replacement for the regular vacation program. If your end goal is simply to shut down things ASAP, you might want to consider replacing Sendmail with Postfix just so you have a simpler and more secure system during the transition period, and then the virtual vacation responder instructions behind the link should be easy to just plug and play. (See also https://benjaminjchapman.wordpress.com/2012/07/31/creating-a-vacation-message-in-centos/ for a sort of middle ground.)
| Auto-Reply to Messages Sent to Mailing List |
1,557,493,455,000 |
I am trying to secure connections to my MySQL server. I have SSL set up but I am looking for programs that support a SSL connection to MySQL. Specifically I am currently looking for an email server that supports it. I am coming from a Windows environment and I was using hMailServer (which doesn't look like it supports a MySQL connection with SSL). I have tried searching Google and here for things like dovecot using mysql ssl or mysql require ssl postfix. I seem to always get something like setting up Postfix, Dovecot, Mysql and SSL but they mean SSL for the IMAP, SMTP and POP3 connections not the mysql backend connection. Can anyone tell me if Dovecot/Postfix support connecting to mysql using ssl and if so, how to do it? If not what can I use? or, how can I create a secure connection for all of my services: owncloud, a custom developed webapp using nodejs with mysql, and email? I think that's everything. Currently they are on the same machine but I would like to make sure I could move things in future.
I am really interested in making my stuff as secure as possible.
:EDIT:
The accepted answer and it's associated comments form an acceptable answer.
|
As far as all your services are located on the same host you really do not need any SSL encryption between services. Just restrict internal services to the localhost - that is all.
In term of MySQL you have to modify my.cnf:
. . . . . .
[mysqld]
bind-address = 127.0.0.1
port = 3306
socket = /tmp/mysql.sock
. . . . . .
Here you restrict mysql to accept connections on the loopback interface ONLY (i.e. from locally running processes) and via file socket that accessible also for locally running pocesses only.
| Looking for an email server that supports mysql ssl connection |
1,557,493,455,000 |
How do I find all the scripts that have mail sitting in my postfix mail queue? This server is sending out spam and I've spot checked it, but I want to make sure I haven't missed any scripts that may be included. PHP is configured to place the X-PHP-Originating-Script header in each email. If I can iterate over each email to find all those headers I should be able to find all relevant scripts.
|
This oneliner gathers the mailq output (I often pipe that to a file and then run the script against the file so I can tweak it with less performance impact). Then it cuts out only the mail ID first by using the cut command to identify the proper field and then using egrep to clean that up (removing empty lines, irrelevant IDs ending in * and lines starting with a ( or -. xargs puts each ID into postcat to output the contents including headers. Then we look for the header, sort them so the uniq command works properly and find just one instance of each script with uniq.
mailq |cut -f 1 -d " "|egrep -v "^\(|^$|^-|\*" |xargs postcat -q |grep "X-PHP-Originating-Script"|sort|uniq
| Find all the PHP scripts with email in my postfix mail queue |
1,557,493,455,000 |
I need to send an email from my Ubuntu 12.04 machine. I am using mailx command to do that. Below is the command I am using which works fine.
echo "Test server started at `date +"%F %T"` on `hostname -f`" | mailx -r "[email protected]" -s "Test Email" "[email protected]"
But when I get an email, I see in my From section as [email protected] and in my To section, I can see [email protected] and [email protected].
Why not it is showing [email protected] in my From and only [email protected] in To once I get an email.
In general what I am trying to do is - I need to send an email from [email protected] to [email protected] so that in From section I should see [email protected] and in To section I should see [email protected] in my email instead of my machine name in the From section.
It looks to me that we need to change something while installing mailutils? I installed it using sudo apt-get install mailutils
How to send an email using mailx so that From and To appear correctly in the email?
I am running Ubuntu 12.04 -
david@machineA:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04 LTS
Release: 12.04
Codename: precise
|
I believe mailutils doesn't support the -r option. Replace it with the heirloom-mailx package which does support the -r option (or use sendmail -r [or -f]).
http://manpages.ubuntu.com/manpages/lucid/man1/mail.1.html
-p, -r, --print, --read
print all mail to standard output
Install:
sudo apt-get install heirloom-mailx
| How to send an email using mailx so that From and To appear correctly in the email? |
1,557,493,455,000 |
I have a Raspberry Pi with Raspian installed on it and I am experiencing troubles sending out emails.
I have installed SSMTP and usually inside my scripts I'm sending out emails to notify me when a job is completed:
echo "$(date) Job completed" | mail -s "My subject" [email protected]
Everything was working fine until a couple of months ago, when I stopped receiving emails. I tried to manually launch the script and I receive this error:
send-mail: 550 Your authenticating ID must match your sending address.
I suspect there's something wrong in my SSMTP configuration, that at the beginning my email provider wasn't checking and now it's not working.
Here you can find my ssmtp.conf file:
#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=postmaster
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=mail
# Where will the mail seem to come from?
#rewriteDomain=
# The full hostname
hostname=raspberrypi
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES
AuthUser=myUser
AuthPass=myPassword
mailhub=mysite.smtp.com:587
UseSTARTTLS=YES
I think there's something wrong, but I'm not a sysadmin and I don't have so much experience with mail services, any suggestions?
|
authenticating ID must match your sending address.
The server mysite.smtp.com: (or more specifically, the MTA its running) rejects your mail, because you authenticate as one user (myUser), but send a mail as another user.
| SSMTP returns error 550 |
1,557,493,455,000 |
I am using uuencode with mailx to attach a zip file. In following code, the if block works perfectly and I get Deletions.zip as an attachment in the email. But, whenever the else block is executed I don't get the attachment but the binary code in the email body instead.
Code (Perl code invoking linux commands):
open(EF,'>', "/test/emailbody.txt") or die $!;
if ($#dzones != -1) {
unshift @dzones, "Following files have 20% or more deletions --\n\n";
unshift @dzones, "Start time: $localtime\n\n";
my $localtime = scalar localtime();
push @dzones, "End time: $localtime\n\n";
print EF @dzones;
`cd /test/DOUT/; zip -q9 /tmp/deletions.zip ./*.*`;
`(cat /test/emailbody.txt;uuencode /tmp/deletions.zip Deletions.zip) | mailx -s "Device deletions" vishal\@test.com`;
} else {
push @dzones, "No files have more than 20% deletions.\n\nPlease see attached for the deletions in different zones.\n\nThanks, Vishal\n\n";
print EF @dzones;
`cd /test/DOUT/; zip -q9 /tmp/deletions.zip ./*.*`;
`(cat /test/emailbody.txt;uuencode /tmp/deletions.zip Deletions.zip) | mailx -s "Device deletions" vishal\@test.com`;
}
close(EF);
When else block is executed, all I get is:
begin 644 Deletions.zip
M4$L#!!0``@`(`.U6,D4]>N/[=0$``&@&```D`!4`9&5L7VYE7T%L8F5R=&%?
… [snip] …
+`"H+``"R'```````
`
end
What am I doing wrong?
|
It looks like the causing problem is being caused during looping of while cat /test/emailbody.txt;
Remove the "," while printing in file. Following line of code has this problem:
push @dzones, "No files have more than 20% deletions.\n\nPlease see attached for the deletions in different zones.\n\nThanks, Vishal\n\n";
| Uuencode displaying attachment content in email body |
1,557,493,455,000 |
As someone who had no experience dealing with Unix or Linux before about 6 months ago, I'm feeling pretty comfortable with managing a Linux server now. The one question I do have is about DenyHosts, and how it's sending out reports.
Firstly, I get about 3 to 4 DenyHosts reports a day. My first question is, is it really true that that many people are trying to brute-force my server? Every time someone is locked out, I get an email that a host has been denied access, which isn't that important to me, as I'm the only human user on the system.
Is there a better way to handle the flood of emails coming to me, or a better way to stop people from trying to gain access to my server? Currently I have all of my root email forwarded to an actual email address, so I don't have to login via SSH to read it. (Root login is disabled, so I login as myself and sudo su into root.
Any insight into this would be much appreciated.
|
Re: "brute-forcing my server":
You can take a look at what sshd is logging, usually somewhere below /var/log. After that you might have trouble sleeping for a while...
Re: "flood of emails":
You might want to look into handling emails locally, i.e. on the server. There are tools like "procmail" around which can be configured to sort, discard or forward messages according to quite flexible criteria.
| How can I reduce the volume of DenyHosts emails? |
1,400,099,355,000 |
I need to manually be able to interact (check, remove, etc) with the postfix mail queue (through scripts and what-not). I know that this generally is a bad idea; so how can I interact with the queue without screwing things up?
I believe one possible solution is to shutdown postfix, do work on the queue, and then start postfix?
|
You have two commands: postqueue and postsuper. Check man page for this commands.
| Manually interacting with postfix mail queue |
1,400,099,355,000 |
We have two domains. One of which is isolated. We're trying to forward mail from one domain, through a DMZ to a relay on the other domain. Using EHLO through telnet works. Using the mail command and specifying the relay works:
mail -S smtp=myrelay.com -s test [email protected]
Sendmail does not work though but claims that the mail would be deliverable:
sendmail -bv [email protected]
[email protected]: mailer relay, host myrelay.com, user [email protected]
sendmail -v [email protected]
mycompany.com: Name server timeout
[email protected]... Transient parse error -- message queued for future delivery
So what's the deal? It says it's deliverable to myrelay.com but then tries to send it to mycompany.com instead. Anyone have any advice where to look to fix this?
|
A "name server timeout" indicates that the name "mycompany.com" can not resolve.
What happens if you do a ping mycompany.com (NOTE: Because of MX records, a failed ping does not mean it's impossible for mail to go there)
While not quite the same as doing a ping text, what does host mycompany.com give you?
Some other useful information can be gleamed from grep hosts /etc/nsswitch.conf
| Sendmail relay to dmz to another relay |
1,400,099,355,000 |
I'm currently experimenting with working with Outlook.com for an email server, and have MX records set up to point there and the like. How can I configure systems like postfix to use external servers for mail? When I try to use functions like PHP's mail() for example, the server logs return this line, obviously because user isn't a user on my system, but rather is on an external mail server.
ABBAB100B92: to=<[email protected]>, relay=local, delay=0.06, delays=0.04/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user: "user")
Might it be easier to run a mail server right off of the VPS I'm hosting my website on, so that everything stays local? Or is that not a very good idea?
System is an Ubuntu 12.04.3 LTS
|
For Postfix, you need to set relayhost in your configuration, and some other options as well. There are many articles online explaining how to do this, for example this one.
Might it be easier to run a mail server right off of the VPS I'm hosting my website on, so that everything stays local?
I don't think that would be easier.
Or is that not a very good idea?
No, it's not, because email coming directly from your server will probably have a higher probability of being classified as spam based on its IP address than email coming from a reputable provider such as Outlook.com.
| Sending mail to an external server? |
1,400,099,355,000 |
At the moment, I have a RHEL6 monitoring server that sends out emails with postfix. Originally it was sending them out as [email protected].
I've used the mapping file /etc/postfix/generic to get the emails sent out now as [email protected], however when the email client receives the email, there is no longer a name attached to the email address.
Originally, with the default configuration, emails would come in with the sender as this -
user <[email protected]>
Now when I recevied the emails, they come in with just the email address -
[email protected] - there is no longer a name displayed.
I've googled and looked at docs but can't seem to figure out the way to do this.
Is there a way for postfix to fix that or append the name that I want ? Or is it up to the script calling mail to append a name to the sender ?
|
Turns out the GECOS field needs to be filled in for the original user, not the user that the emails are being masqueraded to appear to be from.
| Postfix Masquarade Name *and* Email address |
1,400,099,355,000 |
We have a domain for a web site and e-mail that's hosted off-site. (We don't have a reliable enough connection to host it ourselves.)
Our shared host sometimes has SMTP problems, but never POP problems.
Is it possible to set up an e-mail server on CentOS 6.4 that will work internally (i.e. sending between e-mail addresses on our domain, even though our network domains are named differently than our web site) even if our Internet is down or our shared host's SMTP server is down, but will use our shared host's SMTP for outside addresses, and will still allow POP mail to be retrieved from the shared host, e.g. when we're at home or on the road?
|
There are several possible solutions to this problem, and they're all fairly complex. This is the most transparent configuration I could think of, but honestly I would switch hosts if their SMTP service is unreliable. There are a lot of good, cheap providers of mail services. Also, consider using IMAP instead of POP3, as it will alleviate issues with synchronization likely to arise from such a setup.
The solution is complicated because of the necessary coupling between a Mail Transfer Agent (MTA) and a Mail Delivery Agent (MDA). In order for an email to exist on the POP3 server (the MDA), it must have been delivered through the unreliable SMTP server (the MTA). Your MTA can't store messages on the remote MDA, and the remote MTA can't send messages to your MDA. Without complete synchronization of messages in both directions, intra-company email (the "sending between e-mail addresses on our domain" part) sent from the office will only be stored on the local MDA. This means that users working away from the office would not receive internal emails when checking the hosted POP3 account.
You will need at minimum:
MTA for SMTP - Courier is the default for CentOS and a good choice
Firewall (for IP/port redirection) - netfilter or rinetd will work
MDA and Proxy for POP3/IMAP accounts - Perdition is probably best, Courier has this functionality
Local MTA for Backup SMTP
Add your mail host's SMTP server (the remote MTA) in /etc/courier/esmtproutes (or wherever that file gets installed on CentOS) to make Courier forward all messages to it. When your host's SMTP is down, the local MTA will queue outbound mail and retry delivery to the remote MTA at a configurable interval.
Port Redirection
Configure your firewall to forward all outbound traffic on port 25 to your local MTA.
You can implement only the above for the simplest configuration. It would not allow internal email to continue as normal, but it would make the remote MTA downtime less noticeable
Local MTA with Hosted Domain
Add your company domain as a hosted domain for Courier (the local MTA) in /etc/courier/hosteddomains. This will override the smarthost and deliver messages according to the configured routing rules. See makehosteddomains and Transport Modules for more information.
Local MDA and Proxy
This can be implemented in many ways, but for example:
Keep a local copy of email account credentials and use them to authenticate users to the local MDA, which could by default deliver to a "Local" folder for each user account
Use courier-authlib/authpipe or Perdition to relay those credentials to the remote MDA at the same time, comprising the rest of the folders
Set up a cron job to retry sending new messages in the "Local" folder to the remote MTA when the SMTP service is up
...Or implement internal DNS and:
Change MX preferences on the company domain, routing everything to both MTAs (would technically require two internal MTAs)
or
Just use a different (even fake) domain name for intra-office emails, and implement it as a failover system
| SMTP/POP server only for internal e-mails on hosted domain |
1,400,099,355,000 |
I've just installed the 'mail' command in Ubuntu (mailutils package) in order to
view feedback from cron jobs.
I type 'mail' at the prompt and see something like this:
"/var/mail/*$USER*": 1 message 1 unread
>U 1 *Name* *Date* Output from your job
I type 1 at the ? prompt and get a lot of output about the message (From, Date, Subject...) but on the last line it says
Error: Can't open display:
?
and I'm returned to the prompt.
Does anyone have any idea what the problem might be?
|
The mail program opens emails in a pager. The environment variable PAGER can override the default pager, which is typically less. In Debian-based systems, there is a /usr/bin/pager that is managed by the alternatives system. You need to ensure that your pager is not a GUI application, which would require X. An easy way to test this is to set PAGER temporarily.
PAGER=/usr/bin/less mail
| Linux 'mail' command: Can't open display |
1,400,099,355,000 |
I have created a ipset with a bunch of IPs that I want to block access to dovecot and exim.
The ipset is called "bannedIPs" and have been added to iptables using this
iptables -A INPUT -p tcp --dport 25 -m set --set bannedIPs src -j DROP
iptables -A INPUT -p tcp --dport 587 -m set --set bannedIPs src -j DROP
iptables -A INPUT -p tcp --dport 465 -m set --set bannedIPs src -j DROP
iptables -A INPUT -p tcp --dport 110 -m set --set bannedIPs src -j DROP
iptables -A INPUT -p tcp --dport 143 -m set --set bannedIPs src -j DROP
iptables -A INPUT -p tcp --dport 993 -m set --set bannedIPs src -j DROP
iptables -A INPUT -p tcp --dport 995 -m set --set bannedIPs src -j DROP
my question is:
Are these rules correct? Will they block IPs on the bannedIPs ipset from accessing exim and dovecots on all ports of these services?
|
Yes, and no.
You didn't tell us what service you are running, imap(s) or pop, smtp(s) etc., and if it's all using the default port.
But, to verify that you've collected all necessary ports, run i.e netstat -luantp to get a list of listening ports. Then compare the list of ports against it.
Also, consider put these rules into a single one,
iptables -A INPUT -p tcp -m multiport --dports 25,587,465,110,143,993,995 -m set --match-set bannedIPs src -j DROP
To save / restore ipset lists, try ipset save > ipset.rules and ipset restore < ipset.rules
| IP set to block access to exim and dovecot |
1,400,099,355,000 |
I have a following setup:
1 postfix server: a.example.com that needs to accept all emails for any subdomain on example.com (*@*.example.com) and delivers to mailman account and also send emails to any email account (gmail, yahoo, etc) including *@example.com.
1 hosted exchange: exch11.hosted.com for example.com emails (*@example.com).
Everything works in this setup except sending emails from a.example.com to *@example.com (exch11.hosted.com).
If I have example.com in mydomains.db file, then a.example.com does not send out *@example.com emails and delivers locally. if I change it to *.example.com then it sends *@example.com emails to exch11.hosted.com but now does not accept *@subdomain.example.com emails and shows an error that Relay is not allowed (it should not be relaying and delivering to local maildir account).
Main requirement is to have a.example.com accept mail for any subdomain and deliver emails for main domain to exch11.hosted.com. Can anyone please help me or point me towards right direction?
Any help is welcome.
Thanks.
main.cf:
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mydestination = hash:/etc/postfix/mydomains
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
home_mailbox = Maildir/
smtpd_banner = mail.example.com
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
xxgdb $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.3.3/samples
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
virtual_alias_maps = hash:/etc/postfix/virtual, pcre:/etc/postfix/virtual.pcre
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtp_sasl_security_options = noplaintext
#smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender-access
smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/inbound-access,permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
mailbox_size_limit = 25600000
transport_maps = hash:/etc/postfix/transport
message_size_limit = 20240000
virtual.pcre and virtual:
/(.*)@[^.]*\.example\.com$/ mailman
transport:
# demo
.demo.example.com smtp:192.168.100.161:25
# demo mail
demo.example.com smtp:192.168.100.161
# Demo2
.demo2.example.com smtp:192.168.100.221:25
# demo2 domain
demo2.example.com smtp:192.168.100.221
mydomains:
localhost OK
mail.local OK
example.com OK
|
First of all i am not sure if this will work but i hope it will help get you started:
Remove example.com from mydomains as this postfix instance does not handle the mail for it directly.
Add virtual_alias_domains = .example.com this should solve your subdomain issue
Add relay_domains = example.com and specify an explicit transport for example.com, e.g: example.com :[exch11.hosted.com]
| Postfix Configuration - different servers for subdomains and domain |
1,400,099,355,000 |
I'm trying to send cron output to an email address and am struggling... I'm running the following command:
13 15 * * 1-5 root /path/to/mysql-backup.sh 2>&1 | mail -s "Daily Database Backup Report" [email protected]
That shows this error within /var/mail/root
/usr/bin/mail: line 1: syntax error near unexpected token `('
/usr/bin/mail: line 1: `Config file not found (-s)'
Is this trying to validate/execute the output of the cron?
Do you do this on your server? If so, how?
|
In my experience, /usr/bin/mail is a binary executable, but on your system the shell seems to be loading and interpreting it. syntax error near unexpected token is a bash diagnostic.
This can happen if you have overwritten an executable. Is there any conceivable chance that you have overwritten /usr/bin/mail with the text "Config file not found (-s)", causing said text to be fed to the shell when you try to execute it?
| Sending cron output to email? |
1,400,099,355,000 |
After syncing my local maildir inboxes with offlineimap and performing spam filtering and sorting using fdm+bogofilter, I tag the messages in the mail store using notmuch.
Up until recently, I used the following shell code to tag and re-tag messages depending on certain criteria:
notmuch new
tr -s '\t' ' ' <<'END_BATCH' | notmuch tag --batch
-inbox +sent -- folder:/Sent/
-inbox +archive -- folder:/Archive/
-inbox +junk -- folder:/Junk/
+unsorted -- folder:/INBOX.Unsorted/
-unsorted -- not folder:/INBOX.Unsorted/
-unread -- tag:archive
+unread -- tag:unsorted
END_BATCH
This removes the inbox tag from any message in a Sent, Archive or Junk folder, while retagging the messages with the appropriate tags for those three folders. It then tags or untags messages depending on whether they are in an INBOX.Unsorted folder (where I put messages that bogofilter couldn't classify). Lastly, I ensure that archived messages are not tagged as unread and that unsorted messages are tagged as unread.
This worked well.
Since I receive mail on five different accounts, I then also wanted to add tags like account-somename, account-othername etc. to messages, depending on the folder name:
notmuch new
tr -s '\t' ' ' <<'END_BATCH' | notmuch tag --batch
-inbox +sent -- folder:/Sent/
-inbox +archive -- folder:/Archive/
-inbox +junk -- folder:/Junk/
+unsorted -- folder:/INBOX.Unsorted/
-unsorted -- not folder:/INBOX.Unsorted/
-unread -- tag:archive
+unread -- tag:unsorted
+account-acc1 -- folder:/acc1/
+account-acc2 -- folder:/acc2/
+account-acc3 -- folder:/acc3/
+account-acc4 -- folder:/acc4/
+account-acc5 -- folder:/acc5/
END_BATCH
The tagging seems to be performed as expected, but a side-effect is that new messages are marked as old (moved from the maildir's new directory to the cur directory). This in turn means mutt won't detect the new messages in the inboxes (unless I set maildir_check_cur in the mutt configuration, which I don't think is a nice solution).
I don't know why or what I could do to stop this from happening.
My notmuch configuration:
[database]
path=/home/myself/Mail/inboxes
[user]
name=myname
[email protected]
[email protected]
[new]
tags=inbox;unread
[search]
[maildir]
syncronize_flags=true
[index]
header.List=List-Id
|
This seems to happen because notmuch is a bit too pedantic about what message files should go in what Maildir subdirectory, and because offlineimap is a bit too relaxed about the same thing.
The offlineimap utility delivers mail messages into the target Maildir's new directory, as expected, but the filenames have a :2, filename suffix, denoting "this mail message have no flags". Usually, brand new, unseen, and just delivered message files should not have this filename suffix because it's the user's MUA (mail client) that adds it.
When notmuch is configured to synchronise Maildir flags (which you most likely want it to do), it notices that the message files have the :2, filename suffix and therefore assumes that the user must have seen the messages in their MUA, but that they have not read them (there is no S after the comma in the suffix). It then moves the message files to the cur directory. The mutt mail client consequently displays them as "old" (seen but unread).
The solution would be to correct the behaviour of offlineimap, but it was already brought up as a bug and dismissed in 2015.
My solution is to take offlineimap out of the equation. Instead, I fetch all my mail using fdm. I might look into another IMAP syncing solution later (mbsync?) because having a few weeks' worth of mail on the mail servers is good for accessing it away from my main machine.
| Tagging mail with "notmuch" marks them as old |
1,400,099,355,000 |
#!/bin/bash
df -m > myfile
server_ip_address=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1)
if awk '$2 > 10000 && $5 > 90' myfile ; then
echo "Disk Full in $server_ip_address"
else
echo "Nothing wrong with the server"
fi
When I execute the script, always get disk full as output?
Output of df -m looks like this:
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/mapper/centos-root 949305 512827 436479 55% /
devtmpfs 3811 0 3811 0% /dev
tmpfs 3823 0 3823 0% /dev/abc
tmpfs 3823 18 3806 1% /run
tmpfs 3823 0 3823 0% /sys/fs/cgroup
/dev/sda2 1014 175 840 18% /boot
/dev/sda1 1022 12 1011 2% /boot/efi
tmpfs 765 0 765 0% /run/user/2000
The outut of df -m differs from server to server. I am thus comparing if Size>10GB and Use%>90%. As some disk with size<10GB may not be important to be under 90% disk usage.
Update 1:
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
OS is centos 7
Problem with the current code:
I need to compare from the second row to last row columns, but my current code is comparing the first rows columns, that's why I suppose it's not working. How to resolve the issue?
|
Problem in my current code is that the output of df -H is not always in GB
The answer here is not to use -H. As documented in man df it is intended as "human readable output" and the unit intentionally can vary.
Instead use a fixed unit: either the default KB or maybe MB (-m).
You may also want to read up about Nagios (Icinga). This is a monitoring tool that includes scripts to address exactly the sort of monitoring that you are addressing.
When I execute the script, always get disk full as output
This is because if awk ... always returns true, because the awk always ends successfully unless it encounters an error attempting to execute its script (file not found, syntax error, etc.), or the script exits with a specific non-zero status
I would be inclined to consider writing the script like this
#!/bin/sh
myIP=$(
ip -j route |
jq -r '.[] | select(.dst == "default") | .gateway'
)
df=$(
df -lm -x tmpfs |
awk '
NR==1 { header=$0 }
$5+0 > 90 { if (length(header)) { print header; header="" }; print }
'
)
if [ -n "$df" ]
then
echo "Problems with server $myIP"
echo
echo "$df"
else
echo "Disk space seems ok on $myIP"
fi
| Script to send an alert mail once the disk space is above 90% sends disk full even when the disk isn't full, how to resolve this issue? |
1,690,930,939,000 |
I recently attempted to install iRedMail on a container running Ubuntu 20.04 on my Proxmox server in my home lab. Everything apart the port 25 is working perfectly (updates, remote connection, remote access…). The installation was successful, but I noticed that outbound port 25 was timing out. Here's the output of my attempt to connect to gmail-smtp-in.l.google.com on port 25 using Telnet:
$ telnet gmail-smtp-in.l.google.com 25
Trying 172.217.218.27...
Connection failed: Connection timed out
Trying 2a00:1450:4013:c14::1a...
telnet: Unable to connect to remote host: Network is unreachable
I suspected that it might be an issue with my ISP, so I contacted them, and they confirmed that they had unblocked outbound port 25. I also tried to run the same Telnet command on another server within the same network, and it worked, so it looks like a Proxmox problem:
$ telnet gmail-smtp-in.l.google.com 25
Trying 2a00:1450:400c:c06::1b...
Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP q15-20020adff78f000000b0031421b48312si60007wrp.637 - gsmtp
To further investigate, I checked if any firewall rules were enabled, but both the GUI and the iptables command showed that no firewall rules were set up (both on the host and the container):
$ iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
I also verified the DNS configuration, and it appears to be functioning correctly:
$ nslookup gmail-smtp-in.l.google.com
Server: 192.168.1.254
Address: 192.168.1.254#53
Non-authoritative answer:
Name: gmail-smtp-in.l.google.com
Address: 172.217.218.27
Name: gmail-smtp-in.l.google.com
Address: 2a00:1450:4013:c08::1b
Here is an additional network capture of port 25 if it could be useful.
If you require any additional information, please let me know. Thank you for your assistance!
|
If all the information you've provided is correct then it is unlikely to be an issue with the PVE host.
I also tried to run the same Telnet command on another server within the same network, and it worked
I think you mean you tried from another host. If this is using the same uplink as Proxmox then it suffices to rule out any issue at the ISP. Did you try from a shell running on the Proxmox host? Or from another VM?
Everything apart the port 25 is working perfectly
Did you compare the routing tables on the impacted VM vs the control host (i.e. the one which connected)?
Did you also test these using telnet from the impacted VMs shell? HTTP access, for example, might be routed via a proxy.
In the absence of additional information my guess would be a firewall at your end which has rules permitting access from the control host but not the VM.
The issue seemed to have fixed itself, it looks like Proxmox had to wait some time before realizing that port 25 was open
Very unlikely.
| Outbound port 25 server issue |
1,690,930,939,000 |
I have requirement to rewrite a single recipient address. Not just aliasing, because the email To: lines has to be changed. I.e.,.
I tried adding this to sendmail.mc:
FEATURE(`genericstable')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')
Then I add the following to /etc/mail/genericstable, in order that [email protected] gets changed to [email protected]:
[email protected] [email protected]
Then I add both domains to /etc/mail/genericsdomain (both are on separate lines:
bongo.com
gmail.com
Should that now rewrite [email protected] to [email protected]?
It's not working, it's still trying to send to [email protected] I must be doing something wrong.
|
Sendmail: Rewriting selected header recipient addresses
See FEATURE(genericstable) - Remark about FEATURE(allmasquerade) is crucial in your case.
| Can Sendmail rewrite a specific To: address, so that a different email shows up in the To line? |
1,690,930,939,000 |
Following is my shell script which I am running on Ubuntu 20.04 as pipeline task.
echo "line1"
sudo apt-get update
echo "line2"
sudo apt install snapd
echo "line3"
#sudo apt-get install -y xpdf
sudo snap install okular
echo "line4"
sudo apt install mailutils
echo "line5"
sudo apt install mutt
However, I am getting failures and mailutils as well as mutt is not getting installed. I am not able to find what exactly is wrong.
Can someone help.
Following is the log.
2023-06-12T10:03:49.0615819Z ##[section]Starting: Install mail agents
2023-06-12T10:03:49.0620141Z ==============================================================================
2023-06-12T10:03:49.0620279Z Task : Bash
2023-06-12T10:03:49.0620345Z Description : Run a Bash script on macOS, Linux, or Windows
2023-06-12T10:03:49.0620458Z Version : 3.214.0
2023-06-12T10:03:49.0620527Z Author : Microsoft Corporation
2023-06-12T10:03:49.0620605Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
2023-06-12T10:03:49.0620741Z ==============================================================================
2023-06-12T10:03:49.2001702Z Generating script.
2023-06-12T10:03:49.2022486Z ========================== Starting Command Output ===========================
2023-06-12T10:03:49.2035671Z [command]/usr/bin/bash /home/vsts/work/_temp/30cb8767-1ec0-4c8d-904d-bf75d1b0dcb8.sh
2023-06-12T10:03:49.2086880Z line1
2023-06-12T10:03:49.3512316Z Hit:1 http://azure.archive.ubuntu.com/ubuntu focal InRelease
2023-06-12T10:03:49.3513520Z Get:2 http://azure.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
2023-06-12T10:03:49.3514187Z Get:3 http://azure.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
2023-06-12T10:03:49.3525074Z Get:4 http://azure.archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
2023-06-12T10:03:49.3629348Z Hit:5 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu focal InRelease
2023-06-12T10:03:49.3835445Z Get:6 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease [3611 B]
2023-06-12T10:03:49.9524150Z Get:7 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2613 kB]
2023-06-12T10:03:49.9818079Z Get:8 http://azure.archive.ubuntu.com/ubuntu focal-updates/main Translation-en [440 kB]
2023-06-12T10:03:49.9825266Z Get:9 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 c-n-f Metadata [16.8 kB]
2023-06-12T10:03:49.9916353Z Get:10 http://azure.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1937 kB]
2023-06-12T10:03:50.0046726Z Get:11 http://azure.archive.ubuntu.com/ubuntu focal-updates/restricted Translation-en [273 kB]
2023-06-12T10:03:50.0155209Z Get:12 http://azure.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1070 kB]
2023-06-12T10:03:50.0279798Z Get:13 http://azure.archive.ubuntu.com/ubuntu focal-updates/universe Translation-en [255 kB]
2023-06-12T10:03:50.0287027Z Get:14 http://azure.archive.ubuntu.com/ubuntu focal-updates/universe amd64 c-n-f Metadata [25.0 kB]
2023-06-12T10:03:50.1013907Z Get:15 http://azure.archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [45.7 kB]
2023-06-12T10:03:50.1034309Z Get:16 http://azure.archive.ubuntu.com/ubuntu focal-backports/main amd64 c-n-f Metadata [1420 B]
2023-06-12T10:03:50.1495430Z Get:17 http://azure.archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [25.0 kB]
2023-06-12T10:03:50.1506617Z Get:18 http://azure.archive.ubuntu.com/ubuntu focal-backports/universe amd64 c-n-f Metadata [880 B]
2023-06-12T10:03:50.2194139Z Get:19 http://azure.archive.ubuntu.com/ubuntu focal-security/main amd64 Packages [2232 kB]
2023-06-12T10:03:50.2387760Z Get:20 http://azure.archive.ubuntu.com/ubuntu focal-security/main Translation-en [358 kB]
2023-06-12T10:03:50.2433105Z Get:21 http://azure.archive.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [13.0 kB]
2023-06-12T10:03:50.2457368Z Get:22 http://azure.archive.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [1833 kB]
2023-06-12T10:03:50.2666230Z Get:23 http://azure.archive.ubuntu.com/ubuntu focal-security/restricted Translation-en [256 kB]
2023-06-12T10:03:50.2675256Z Get:24 http://azure.archive.ubuntu.com/ubuntu focal-security/universe amd64 Packages [844 kB]
2023-06-12T10:03:50.2814081Z Get:25 http://azure.archive.ubuntu.com/ubuntu focal-security/universe Translation-en [174 kB]
2023-06-12T10:03:50.2822713Z Get:26 http://azure.archive.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata [18.5 kB]
2023-06-12T10:03:50.4612538Z Get:27 https://packages.microsoft.com/ubuntu/20.04/prod focal/main arm64 Packages [41.0 kB]
2023-06-12T10:03:50.4632779Z Get:28 https://packages.microsoft.com/ubuntu/20.04/prod focal/main armhf Packages [14.6 kB]
2023-06-12T10:03:50.4655137Z Get:29 https://packages.microsoft.com/ubuntu/20.04/prod focal/main amd64 Packages [202 kB]
2023-06-12T10:03:56.8883268Z Fetched 13.0 MB in 3s (4990 kB/s)
2023-06-12T10:03:58.0626193Z Reading package lists...
2023-06-12T10:03:58.0844624Z line2
2023-06-12T10:03:58.0950202Z
2023-06-12T10:03:58.0951019Z WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
2023-06-12T10:03:58.0951268Z
2023-06-12T10:03:58.1490184Z Reading package lists...
2023-06-12T10:03:58.3585009Z Building dependency tree...
2023-06-12T10:03:58.3600185Z Reading state information...
2023-06-12T10:03:58.5574824Z Suggested packages:
2023-06-12T10:03:58.5575936Z zenity | kdialog
2023-06-12T10:03:58.6190432Z The following packages will be upgraded:
2023-06-12T10:03:58.6191325Z snapd
2023-06-12T10:03:58.6629495Z 1 upgraded, 0 newly installed, 0 to remove and 83 not upgraded.
2023-06-12T10:03:58.7341063Z Need to get 37.9 MB of archives.
2023-06-12T10:03:58.7341980Z After this operation, 5120 B of additional disk space will be used.
2023-06-12T10:03:58.7342692Z Get:1 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 snapd amd64 2.58+20.04.1 [37.9 MB]
2023-06-12T10:03:59.5904547Z Fetched 37.9 MB in 0s (79.3 MB/s)
2023-06-12T10:03:59.6538099Z (Reading database ...
2023-06-12T10:03:59.6538861Z (Reading database ... 5%
2023-06-12T10:03:59.6539636Z (Reading database ... 10%
2023-06-12T10:03:59.6540023Z (Reading database ... 15%
2023-06-12T10:03:59.6540916Z (Reading database ... 20%
2023-06-12T10:03:59.6542166Z (Reading database ... 25%
2023-06-12T10:03:59.6542541Z (Reading database ... 30%
2023-06-12T10:03:59.6543252Z (Reading database ... 35%
2023-06-12T10:03:59.6543543Z (Reading database ... 40%
2023-06-12T10:03:59.6543720Z (Reading database ... 45%
2023-06-12T10:03:59.6543894Z (Reading database ... 50%
2023-06-12T10:03:59.6843961Z (Reading database ... 55%
2023-06-12T10:03:59.7174392Z (Reading database ... 60%
2023-06-12T10:03:59.7420502Z (Reading database ... 65%
2023-06-12T10:03:59.7910608Z (Reading database ... 70%
2023-06-12T10:03:59.8534221Z (Reading database ... 75%
2023-06-12T10:03:59.9268643Z (Reading database ... 80%
2023-06-12T10:03:59.9864844Z (Reading database ... 85%
2023-06-12T10:04:00.0558531Z (Reading database ... 90%
2023-06-12T10:04:00.0883297Z (Reading database ... 95%
2023-06-12T10:04:00.0884456Z (Reading database ... 100%
2023-06-12T10:04:00.0884740Z (Reading database ... 231244 files and directories currently installed.)
2023-06-12T10:04:00.1001114Z Preparing to unpack .../snapd_2.58+20.04.1_amd64.deb ...
2023-06-12T10:04:00.1893362Z Unpacking snapd (2.58+20.04.1) over (2.58+20.04) ...
2023-06-12T10:04:04.4297247Z Setting up snapd (2.58+20.04.1) ...
2023-06-12T10:04:07.7589769Z snapd.failure.service is a disabled or a static unit not running, not starting it.
2023-06-12T10:04:07.8097862Z snapd.snap-repair.service is a disabled or a static unit not running, not starting it.
2023-06-12T10:04:07.8428952Z Failed to restart snapd.mounts-pre.target: Operation refused, unit snapd.mounts-pre.target may be requested by dependency only (it is configured to refuse manual start/stop).
2023-06-12T10:04:07.8432355Z See system logs and 'systemctl status snapd.mounts-pre.target' for details.
2023-06-12T10:04:07.9512709Z Processing triggers for man-db (2.9.1-1) ...
2023-06-12T10:04:08.1029650Z Processing triggers for dbus (1.12.16-2ubuntu2.3) ...
2023-06-12T10:04:08.1232132Z Processing triggers for mime-support (3.64ubuntu1) ...
2023-06-12T10:04:11.0475305Z line3
2023-06-12T10:04:36.7058248Z okular 23.04.1 from KDE** installed
2023-06-12T10:04:36.7082316Z line4
2023-06-12T10:04:36.7178819Z
2023-06-12T10:04:36.7179411Z WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
2023-06-12T10:04:36.7180824Z
2023-06-12T10:04:36.7728727Z Reading package lists...
2023-06-12T10:04:37.0000759Z Building dependency tree...
2023-06-12T10:04:37.0015556Z Reading state information...
2023-06-12T10:04:37.1968229Z The following additional packages will be installed:
2023-06-12T10:04:37.1970352Z guile-2.2-libs libgsasl7 libkyotocabinet16v5 libmailutils6 libntlm0
2023-06-12T10:04:37.1974089Z mailutils-common postfix
2023-06-12T10:04:37.1977641Z Suggested packages:
2023-06-12T10:04:37.1978262Z mailutils-mh mailutils-doc procmail postfix-mysql postfix-pgsql postfix-ldap
2023-06-12T10:04:37.1994357Z postfix-pcre postfix-lmdb postfix-sqlite sasl2-bin | dovecot-common
2023-06-12T10:04:37.1995202Z resolvconf postfix-cdb postfix-doc
2023-06-12T10:04:37.2580917Z The following NEW packages will be installed:
2023-06-12T10:04:37.2589341Z guile-2.2-libs libgsasl7 libkyotocabinet16v5 libmailutils6 libntlm0
2023-06-12T10:04:37.2593812Z mailutils mailutils-common postfix
2023-06-12T10:04:37.3018697Z 0 upgraded, 8 newly installed, 0 to remove and 83 not upgraded.
2023-06-12T10:04:37.4312901Z Need to get 7457 kB of archives.
2023-06-12T10:04:37.4314276Z After this operation, 55.9 MB of additional disk space will be used.
2023-06-12T10:04:37.4315002Z Get:1 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 guile-2.2-libs amd64 2.2.7+1-4 [4962 kB]
2023-06-12T10:04:37.5436462Z Get:2 http://azure.archive.ubuntu.com/ubuntu focal-updates/universe amd64 libntlm0 amd64 1.5-2ubuntu0.1 [14.7 kB]
2023-06-12T10:04:37.5566648Z Get:3 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 libgsasl7 amd64 1.8.1-1 [114 kB]
2023-06-12T10:04:37.5720357Z Get:4 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 libkyotocabinet16v5 amd64 1.2.76-4.2build1 [318 kB]
2023-06-12T10:04:37.5874804Z Get:5 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 mailutils-common all 1:3.7-2.1 [272 kB]
2023-06-12T10:04:37.6095921Z Get:6 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 libmailutils6 amd64 1:3.7-2.1 [437 kB]
2023-06-12T10:04:37.6277684Z Get:7 http://azure.archive.ubuntu.com/ubuntu focal/universe amd64 mailutils amd64 1:3.7-2.1 [138 kB]
2023-06-12T10:04:37.6432824Z Get:8 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 postfix amd64 3.4.13-0ubuntu1.2 [1201 kB]
2023-06-12T10:04:38.0327463Z Preconfiguring packages ...
2023-06-12T10:04:38.2077442Z Fetched 7457 kB in 0s (23.0 MB/s)
2023-06-12T10:04:38.2400559Z Selecting previously unselected package guile-2.2-libs:amd64.
2023-06-12T10:04:38.2479684Z (Reading database ...
2023-06-12T10:04:38.2480253Z (Reading database ... 5%
2023-06-12T10:04:38.2481174Z (Reading database ... 10%
2023-06-12T10:04:38.2481428Z (Reading database ... 15%
2023-06-12T10:04:38.2481608Z (Reading database ... 20%
2023-06-12T10:04:38.2481782Z (Reading database ... 25%
2023-06-12T10:04:38.2483803Z (Reading database ... 30%
2023-06-12T10:04:38.2484236Z (Reading database ... 35%
2023-06-12T10:04:38.2485065Z (Reading database ... 40%
2023-06-12T10:04:38.2485485Z (Reading database ... 45%
2023-06-12T10:04:38.2486584Z (Reading database ... 50%
2023-06-12T10:04:38.2531855Z (Reading database ... 55%
2023-06-12T10:04:38.2583036Z (Reading database ... 60%
2023-06-12T10:04:38.2611631Z (Reading database ... 65%
2023-06-12T10:04:38.2763062Z (Reading database ... 70%
2023-06-12T10:04:38.2930945Z (Reading database ... 75%
2023-06-12T10:04:38.3168233Z (Reading database ... 80%
2023-06-12T10:04:38.3335386Z (Reading database ... 85%
2023-06-12T10:04:38.3635851Z (Reading database ... 90%
2023-06-12T10:04:38.3669039Z (Reading database ... 95%
2023-06-12T10:04:38.3669529Z (Reading database ... 100%
2023-06-12T10:04:38.3670895Z (Reading database ... 231244 files and directories currently installed.)
2023-06-12T10:04:38.3768722Z Preparing to unpack .../0-guile-2.2-libs_2.2.7+1-4_amd64.deb ...
2023-06-12T10:04:38.3848654Z Unpacking guile-2.2-libs:amd64 (2.2.7+1-4) ...
2023-06-12T10:04:38.9511654Z Selecting previously unselected package libntlm0:amd64.
2023-06-12T10:04:38.9725995Z Preparing to unpack .../1-libntlm0_1.5-2ubuntu0.1_amd64.deb ...
2023-06-12T10:04:38.9740865Z Unpacking libntlm0:amd64 (1.5-2ubuntu0.1) ...
2023-06-12T10:04:39.0432835Z Selecting previously unselected package libgsasl7:amd64.
2023-06-12T10:04:39.0626697Z Preparing to unpack .../2-libgsasl7_1.8.1-1_amd64.deb ...
2023-06-12T10:04:39.0632733Z Unpacking libgsasl7:amd64 (1.8.1-1) ...
2023-06-12T10:04:39.2912860Z Selecting previously unselected package libkyotocabinet16v5:amd64.
2023-06-12T10:04:39.3116058Z Preparing to unpack .../3-libkyotocabinet16v5_1.2.76-4.2build1_amd64.deb ...
2023-06-12T10:04:39.3128673Z Unpacking libkyotocabinet16v5:amd64 (1.2.76-4.2build1) ...
2023-06-12T10:04:39.3711516Z Selecting previously unselected package mailutils-common.
2023-06-12T10:04:39.3910405Z Preparing to unpack .../4-mailutils-common_1%3a3.7-2.1_all.deb ...
2023-06-12T10:04:39.3925751Z Unpacking mailutils-common (1:3.7-2.1) ...
2023-06-12T10:04:39.4472466Z Selecting previously unselected package libmailutils6:amd64.
2023-06-12T10:04:39.4675490Z Preparing to unpack .../5-libmailutils6_1%3a3.7-2.1_amd64.deb ...
2023-06-12T10:04:39.4691889Z Unpacking libmailutils6:amd64 (1:3.7-2.1) ...
2023-06-12T10:04:39.5392291Z Selecting previously unselected package mailutils.
2023-06-12T10:04:39.5598654Z Preparing to unpack .../6-mailutils_1%3a3.7-2.1_amd64.deb ...
2023-06-12T10:04:39.5616378Z Unpacking mailutils (1:3.7-2.1) ...
2023-06-12T10:04:39.6192570Z Selecting previously unselected package postfix.
2023-06-12T10:04:39.6371906Z Preparing to unpack .../7-postfix_3.4.13-0ubuntu1.2_amd64.deb ...
2023-06-12T10:04:39.9346734Z Unpacking postfix (3.4.13-0ubuntu1.2) ...
2023-06-12T10:04:40.0938004Z Setting up libkyotocabinet16v5:amd64 (1.2.76-4.2build1) ...
2023-06-12T10:04:40.0974578Z Setting up libntlm0:amd64 (1.5-2ubuntu0.1) ...
2023-06-12T10:04:40.1006918Z Setting up mailutils-common (1:3.7-2.1) ...
2023-06-12T10:04:40.1037076Z Setting up postfix (3.4.13-0ubuntu1.2) ...
2023-06-12T10:04:40.4929377Z Adding group `postfix' (GID 128) ...
2023-06-12T10:04:40.5222947Z Done.
2023-06-12T10:04:40.5598903Z Adding system user `postfix' (UID 119) ...
2023-06-12T10:04:40.5599833Z Adding new user `postfix' (UID 119) with group `postfix' ...
2023-06-12T10:04:40.8929605Z Not creating home directory `/var/spool/postfix'.
2023-06-12T10:04:40.9269246Z Creating /etc/postfix/dynamicmaps.cf
2023-06-12T10:04:40.9774330Z Adding group `postdrop' (GID 129) ...
2023-06-12T10:04:40.9869150Z Done.
2023-06-12T10:04:42.6196376Z setting myhostname: fv-az196-427.fsmmeu0u0awerkbajh504c0zwb.fx.internal.cloudapp.net
2023-06-12T10:04:42.6243761Z setting alias maps
2023-06-12T10:04:42.6290490Z setting alias database
2023-06-12T10:04:42.6366271Z changing /etc/mailname to fv-az196-427.fsmmeu0u0awerkbajh504c0zwb.fx.internal.cloudapp.net
2023-06-12T10:04:42.6368334Z setting myorigin
2023-06-12T10:04:42.6417713Z setting destinations: $myhostname, fv-az196-427.fsmmeu0u0awerkbajh504c0zwb.fx.internal.cloudapp.net, localhost.fsmmeu0u0awerkbajh504c0zwb.fx.internal.cloudapp.net, , localhost
2023-06-12T10:04:42.6465214Z setting relayhost:
2023-06-12T10:04:42.6514579Z setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
2023-06-12T10:04:42.6577233Z setting mailbox_size_limit: 0
2023-06-12T10:04:42.6625514Z setting recipient_delimiter: +
2023-06-12T10:04:42.6671146Z setting inet_interfaces: all
2023-06-12T10:04:44.4790092Z setting inet_protocols: all
2023-06-12T10:04:44.4845523Z /etc/aliases does not exist, creating it.
2023-06-12T10:04:44.4914512Z WARNING: /etc/aliases exists, but does not have a root alias.
2023-06-12T10:04:44.5770767Z
2023-06-12T10:04:44.5773779Z Postfix (main.cf) is now set up with a default configuration. If you need to
2023-06-12T10:04:44.5774301Z make changes, edit /etc/postfix/main.cf (and others) as needed. To view
2023-06-12T10:04:44.5775345Z Postfix configuration values, see postconf(1).
2023-06-12T10:04:44.5775639Z
2023-06-12T10:04:44.5776324Z After modifying main.cf, be sure to run 'systemctl reload postfix'.
2023-06-12T10:04:44.5776607Z
2023-06-12T10:04:46.3920111Z Running newaliases
2023-06-12T10:04:46.7295293Z Created symlink /etc/systemd/system/multi-user.target.wants/postfix.service → /lib/systemd/system/postfix.service.
2023-06-12T10:04:49.2956562Z Setting up guile-2.2-libs:amd64 (2.2.7+1-4) ...
2023-06-12T10:04:49.2999183Z Setting up libgsasl7:amd64 (1.8.1-1) ...
2023-06-12T10:04:49.3032060Z Setting up libmailutils6:amd64 (1:3.7-2.1) ...
2023-06-12T10:04:49.3064408Z Setting up mailutils (1:3.7-2.1) ...
2023-06-12T10:04:49.3152308Z update-alternatives: using /usr/bin/frm.mailutils to provide /usr/bin/frm (frm) in auto mode
2023-06-12T10:04:49.3220104Z update-alternatives: using /usr/bin/from.mailutils to provide /usr/bin/from (from) in auto mode
2023-06-12T10:04:49.3286334Z update-alternatives: using /usr/bin/messages.mailutils to provide /usr/bin/messages (messages) in auto mode
2023-06-12T10:04:49.3352820Z update-alternatives: using /usr/bin/movemail.mailutils to provide /usr/bin/movemail (movemail) in auto mode
2023-06-12T10:04:49.3418371Z update-alternatives: using /usr/bin/readmsg.mailutils to provide /usr/bin/readmsg (readmsg) in auto mode
2023-06-12T10:04:49.3484626Z update-alternatives: using /usr/bin/dotlock.mailutils to provide /usr/bin/dotlock (dotlock) in auto mode
2023-06-12T10:04:49.3557161Z update-alternatives: using /usr/bin/mail.mailutils to provide /usr/bin/mailx (mailx) in auto mode
2023-06-12T10:04:49.3593807Z Processing triggers for rsyslog (8.2001.0-1ubuntu1.3) ...
2023-06-12T10:04:49.6626786Z Processing triggers for ufw (0.36-6ubuntu1) ...
2023-06-12T10:04:49.9063089Z Processing triggers for systemd (245.4-4ubuntu3.21) ...
2023-06-12T10:04:50.2002572Z Processing triggers for man-db (2.9.1-1) ...
2023-06-12T10:04:56.4482069Z Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
2023-06-12T10:05:03.5962287Z line5
2023-06-12T10:05:03.6067717Z
2023-06-12T10:05:03.6070529Z WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
2023-06-12T10:05:03.6070919Z
2023-06-12T10:05:03.6623356Z Reading package lists...
2023-06-12T10:05:03.8868079Z Building dependency tree...
2023-06-12T10:05:03.8883028Z Reading state information...
2023-06-12T10:05:04.0992536Z The following additional packages will be installed:
2023-06-12T10:05:04.0995988Z libtokyocabinet9
2023-06-12T10:05:04.1005446Z Suggested packages:
2023-06-12T10:05:04.1006010Z urlview aspell | ispell mixmaster
2023-06-12T10:05:04.1521708Z The following NEW packages will be installed:
2023-06-12T10:05:04.1525971Z libtokyocabinet9 mutt
2023-06-12T10:05:04.1929062Z 0 upgraded, 2 newly installed, 0 to remove and 83 not upgraded.
2023-06-12T10:05:04.2541887Z Need to get 1304 kB of archives.
2023-06-12T10:05:04.2542477Z After this operation, 5283 kB of additional disk space will be used.
2023-06-12T10:05:04.2543127Z Get:1 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 libtokyocabinet9 amd64 1.4.48-12 [359 kB]
2023-06-12T10:05:04.2823416Z Get:2 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 mutt amd64 1.13.2-1ubuntu0.5 [945 kB]
2023-06-12T10:05:04.7278752Z Fetched 1304 kB in 0s (17.6 MB/s)
2023-06-12T10:05:04.7589856Z Selecting previously unselected package libtokyocabinet9:amd64.
2023-06-12T10:05:04.7664818Z (Reading database ...
2023-06-12T10:05:04.7665299Z (Reading database ... 5%
2023-06-12T10:05:04.7665960Z (Reading database ... 10%
2023-06-12T10:05:04.7666230Z (Reading database ... 15%
2023-06-12T10:05:04.7667632Z (Reading database ... 20%
2023-06-12T10:05:04.7668148Z (Reading database ... 25%
2023-06-12T10:05:04.7668734Z (Reading database ... 30%
2023-06-12T10:05:04.7668929Z (Reading database ... 35%
2023-06-12T10:05:04.7669155Z (Reading database ... 40%
2023-06-12T10:05:04.7669870Z (Reading database ... 45%
2023-06-12T10:05:04.7670046Z (Reading database ... 50%
2023-06-12T10:05:04.7700616Z (Reading database ... 55%
2023-06-12T10:05:04.7758454Z (Reading database ... 60%
2023-06-12T10:05:04.7784259Z (Reading database ... 65%
2023-06-12T10:05:04.7929718Z (Reading database ... 70%
2023-06-12T10:05:04.8021696Z (Reading database ... 75%
2023-06-12T10:05:04.8330904Z (Reading database ... 80%
2023-06-12T10:05:04.8476713Z (Reading database ... 85%
2023-06-12T10:05:04.8738789Z (Reading database ... 90%
2023-06-12T10:05:04.8774138Z (Reading database ... 95%
2023-06-12T10:05:04.8774360Z (Reading database ... 100%
2023-06-12T10:05:04.8774588Z (Reading database ... 232279 files and directories currently installed.)
2023-06-12T10:05:04.8873587Z Preparing to unpack .../libtokyocabinet9_1.4.48-12_amd64.deb ...
2023-06-12T10:05:04.8900850Z Unpacking libtokyocabinet9:amd64 (1.4.48-12) ...
2023-06-12T10:05:04.9512189Z Selecting previously unselected package mutt.
2023-06-12T10:05:04.9738765Z Preparing to unpack .../mutt_1.13.2-1ubuntu0.5_amd64.deb ...
2023-06-12T10:05:04.9858718Z Unpacking mutt (1.13.2-1ubuntu0.5) ...
2023-06-12T10:05:05.1283062Z Setting up libtokyocabinet9:amd64 (1.4.48-12) ...
2023-06-12T10:05:05.1317544Z Setting up mutt (1.13.2-1ubuntu0.5) ...
2023-06-12T10:05:05.1503490Z Processing triggers for man-db (2.9.1-1) ...
2023-06-12T10:05:09.8252769Z Processing triggers for mime-support (3.64ubuntu1) ...
2023-06-12T10:05:09.8467979Z Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
2023-06-12T10:05:12.5549219Z ##[error]Bash wrote one or more lines to the standard error stream.
2023-06-12T10:05:12.5562433Z ##[error]
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
2023-06-12T10:05:12.5563158Z ##[error]
2023-06-12T10:05:12.5563717Z ##[error]WARNING:
2023-06-12T10:05:12.5564252Z ##[error]apt
2023-06-12T10:05:12.5564774Z ##[error]
2023-06-12T10:05:12.5565351Z ##[error]does not have a stable CLI interface.
2023-06-12T10:05:12.5565961Z ##[error]Use with caution in scripts.
2023-06-12T10:05:12.5566519Z ##[error]
2023-06-12T10:05:12.5567047Z ##[error]
2023-06-12T10:05:12.5567721Z ##[error]
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
2023-06-12T10:05:12.5572335Z ##[section]Finishing: Install mail agents
|
According to your logs, mailutils and mutt were installed correctly, but your pipeline treats any output to standard error as an error, and apt is writing its warning there:
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
To avoid problems, use apt-get instead:
sudo apt-get update
sudo apt-get install -y snapd
#sudo apt-get install -y xpdf
sudo snap install okular
sudo apt-get install -y mailutils
sudo apt-get install -y mutt
| Failures while setting up mutt on Ubuntu 20.04 |
1,690,930,939,000 |
Im running Debian 11 with Postfix 3.5.17 and I'm having trouble restricting the domains that clients can relay mail to (mail from submission).
I've configured relay_domains to only be the specific domains I want mail relayed to, but if I send a test message to domain.com, the logs show its connecting to it, despite it not being in relay_domains.
It seems relay_domains is not actually denying anything right now, is there an extra config option or restriction needed for this to take affect?
postconf -n:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
anvil_rate_time_unit = 60s
append_dot_mydomain = no
biff = no
compatibility_level = 2
default_destination_rate_delay = 5s
disable_vrfy_command = yes
inet_interfaces = all
inet_protocols = all
invalid_hostname_reject_code = 550
mailbox_size_limit = 0
maximal_backoff_time = 3h
minimal_backoff_time = 180s
mydestination = localhost
mydomain = localmail.com
myhostname = localmail.com
mynetworks = 127.0.0.0/8 172.20.0.0/16 10.10.0.0/16 192.168.0.0/16
myorigin = $mydomain
non_fqdn_reject_code = 550
readme_directory = no
recipient_delimiter = +
relay_domains = protonmail.com, protonmail.ch, mail.protonmail.ch, mailsec.protonmail.ch
relayhost =
smtp_always_send_ehlo = yes
smtp_helo_timeout = 15s
smtp_rcpt_timeout = 15s
smtp_tls_security_level = encrypt
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_client_message_rate_limit = 10
smtpd_client_restrictions = permit_mynetworks, permit_sasl_authenticated,
smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname
smtpd_recipient_limit = 40
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unlisted_recipient, reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous, noplaintext
smtpd_sasl_tls_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_sender, reject_unknown_sender_domain
smtpd_timeout = 30s
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/ssl/certs/mailtls-selfsigned.crt
smtpd_tls_key_file = /etc/ssl/private/mailtls-selfsigned.key
smtpd_tls_security_level = encrypt
smtpd_use_tls = yes
strict_rfc821_envelopes = yes
unknown_address_reject_code = 550
unknown_client_reject_code = 550
unknown_hostname_reject_code = 550
unverified_recipient_reject_code = 550
unverified_sender_reject_code = 550
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf, mysql:/etc/postfix/mysql-virtual-email2email.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
|
The order of restrictions matters, the first matching rule wins.
Because you have permit_mynetworks before any other restrictions, that allows hosts on your local networks to relay to anywhere. Similarly, you have permit_sasl_authenticated as the second restriction, which allows authenticated clients to relay to any domain.
If you don't want that, put reject_unauth_destination before permit_mynetworks and permit_sasl_authenticated.
From man 5 postconf:
reject_unauth_destination
Reject the request unless one of the following is true:
Postfix is a mail forwarder: the resolved RCPT TO domain matches
$relay_domains or a subdomain thereof, and contains no sender-specified
routing (user@elsewhere@domain),
Postfix is the final destination: the resolved RCPT TO domain
matches $mydestination, $inet_interfaces, $proxy_interfaces,
$virtual_alias_domains, or $virtual_mailbox_domains, and contains no
sender-specified routing (user@elsewhere@domain).
The relay_domains_reject_code parameter specifies the response code for
rejected requests (default: 554).
| Postfix deny all relay domain destinations except for relay_domains |
1,690,930,939,000 |
As root, I installed ssmtp and I configured the /etc/ssmtp/ssmtp.conf as follows:
# Sender email address
[email protected]
# Destination SMTP server and port
mailhub=mail.domain.com:587
# Username and password
[email protected]
AuthPass=password
# Sender domain
rewriteDomain=domain.com
# Machine's hostname
hostname=mail.domain.com:587
# Allow set From name in each email
FromLineOverride=YES
UseSTARTTLS=YES
UseTLS=YES
I also configured revaliases in /etc/ssmtp/revaliases adding the following row:
root:[email protected]:mail.domain.com:587
I set a cron running crontab -e and added the rows (just to test it's running):
[email protected]
* * * * * echo "this is a test"
If I run grep cron /var/log/syslog I see the following error:
cron[2704289]: sendmail: RCPT TO:<[email protected]> (553 5.7.1 <[email protected]>: Sender address rejected: not owned by user [email protected])
[email protected] is changed in [email protected]and I cannot find a solution.
Any help?
|
You have inverted the meaning of FromLineOverride. Here with it set to yes you are declaring that the sender is allowed to override the settings defined in ssmtp.conf, and this is why the sender is ending up as root.
Switch that setting off (no) and you should be good to go.
| crontab error - SSMTP - 553 5.7.1 Sender address rejected: not owned by user |
1,690,930,939,000 |
I have a job that picks up CSV files and sends them through an external mail service. Everything seems to be great, with one exception: I found that the windows style CRLF CSV files get mangled by the process and when I open them in a mail client, they have 3 0x0A characters at the end of each line.
I thought it would be easy to force base64 encoding of the files, but though it feels like s-nail should be a Ferrari from a programmability perspective, I can't find the gas pedal. Playing around with the mime settings, I can change the content type, but getting the payload to base 64 is just not happening.
echo "CSV files attached:" | s-nail -vv -Smimetypes-load-control -X'mimetype "application/octet-stream csv"' -r [email protected] -s "Your CSV file" -a /data/review/fun.csv -S smtp-use-starttls -S smtp-auth=login -S smtp-auth-user="[email protected]" -S smtp-auth-password="yourmom" -S smtp="corgibutts.com:587" "[email protected]"
Does anyone have any idea how to make this happen?
|
I found that mac/unix line endings are not getting mangled, and have switched to that for those that can take it.
The author posted this to his mailing list in response to my question, the patch should be widely available about 3 months from now:
I today have implemented such a thing, but it will require v14.10
(hopefully around christmas).
base64 can be enforced by prefixing ! to a character set
specification:
-a file[=[!]input-charset[#[!]output-charset]], --attach=..
(Send mode) Attach file, subject to tilde expansion (see
Filename transformations and folder). In Compose mode the
COMMAND ESCAPES ~@ and especially the scriptable ~^ provide
alternatives for attaching files.
If file is not accessible but contains an equal-sign = a
character set specification is split off. If only an input
one is given it is fixated and no conversion is applied; an
empty, or the special string hyphen-minus - means
ttycharset. If an output one is given the conversion is
performed on-the-fly, not considering file type nor content;
however, empty string or hyphen-minus - enforce the
default Character sets conversion (-a file, -a file=#,
and -a file=-#- are identical), later applied after MIME-
classifying file (HTML mail and MIME attachments, The
mime.types files). Without ,+iconv, in features only this
mode is available. The character set names may be prefixed
with exclamation mark `!' to enforce base64 mime-encoding of
the attachment.
His mailing list has the conversation, I don't see his latest reply there yet, but it should eventually be found here under the base64 encoding thread:
https://lists.sdaoden.eu/pipermail/s-mailx/2022-September/thread.html
| How to force base64 encoding for s-nail attachments? |
1,690,930,939,000 |
How do I specify a default sender 'from:' address in postfix config for emails through smtp?
I'm trying to send emails through SMTP and a relay from two different servers with Oracle Linux 8
The problem is that on one server when you send an email without the '-r' option to specify a sender it doesn't work returning the following message:
A Sender: field is required with multiple addresses in From: field.
No such file or directory
"/root/dead.letter" 1/6
. . . message not sent.
On the other server, sending an email like this works properly and it sends an email as [email protected]
I'll attach consoles of the attempts on both servers:
Sending Email without -r Option in Server 1
Linux server 5.4.17-2102.201.3.el8uek.x86_64 #2 SMP Fri Apr 23 09:05:57 PDT 2021 x86_64 x86_64 x86_64 GNU/Linux
NAME="Oracle Linux Server"
VERSION="8.4"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.4"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:4:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.4
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.4
[root@server1 ~]# mailx -s "SMTP" [email protected]
test.
.
EOT
A Sender: field is required with multiple addresses in From: field.
No such file or directory
"/root/dead.letter" 1/6
. . . message not sent.
[root@server1 ~]#
Sending email without -r in Server 2
Linux server 5.4.17-2102.201.3.el8uek.x86_64 #2 SMP Fri Apr 23 09:05:57 PDT 2021 x86_64 x86_64 x86_64 GNU/Linux
NAME="Oracle Linux Server"
VERSION="8.4"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.4"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:4:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.4
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.4
[root@server2 ~]# mailx -s "SMTP" [email protected]
test
.
EOT
[root@server2 ~]#
|
There are many versions of the mail program, including GNU mailutils and bsd-mailx.
As mail on server2 seems to work correctly, make sure that server1 has the same version as server2.
Use /usr/sbin/sendmail instead of mail to send your message. You're using postfix on both machines, and postfix's sendmail command understands both -r and -f options to set the sender address. See man postfix for details and more options.
| Oracle Linux postfix conf SMTP - Default sender 'from' issue |
1,690,930,939,000 |
I have a VPS running CentOS that hosts a few websites with email. It's recently come to my attention that outgoing emails to @comcast.net addresses are not delivering. I've observed that these emails are stuck in the queue for days before bouncing, so it's not a temporary outage.
-I confirmed the bounces happening to multiple @comcast.net addresses, not just one
-I confirmed that I can send to these same addresses successfully from other email address not hosted on this VPS
-I confirmed the bounces happening FROM multiple emails on multiple domains on this VPS. Originator doesn't seem to matter
So it just seems like this VPS can't send to Comcast. These are the type of errors that come back from Postfix. Does this message mean anything in particular? Any ideas of possible causes?
connect to mx2c1.comcast.net[2001:558:fd00:4f::5]:25: Network is unreachable
connect to mx1a1.comcast.net[2001:558:fd01:2bad::5]:25: Network is unreachable
edit: output of the command 'ip -6 addr show'
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qlen 1000
inet6 fe80::c420:cbff:fe3a:fc09/64 scope link
valid_lft forever preferred_lft forever
|
The request from the IP or IP range may be dropped by their firewall - assuming that these MX are up and running.
Just try to reach them from the shell of the VM and your localhost - if only one of them can reach these, it is save to assume that.
| Postfix can send to everywhere except Comcast? |
1,690,930,939,000 |
In mbox format, each email begins with a "From_" line that contains an "envelope sender address" and timestamp. For example:
From [email protected] Fri Jun 23 02:56:55 2000
How is the address and timestamp in the "From_" line different from the address and date in the "From:" and "Date:" email headers?
|
The From_ line contains the details as received by the SMTP daemon. In particular, the email address is whatever the remote sender provided in the MAIL FROM stage of the SMTP session (this may or may not be the same as what is in the message headers - e.g. it may be a mailing list's bounce address, while the header From: is the original sender's address), and the date is the timestamp of the SMTP session.
See SMTP transport example
The From: and Date: headers, however, are in the text of the message. They are generated by the sender's MUA (e.g. mutt or outlook or whatever) and/or by the sender's MTA (postfix, sendmail, etc) - e.g. an MTA will often be configured to add a Date: or Message-Id: header if either are missing from the message.
| mbox: Difference between "From_" line and the "From:" and "Date:" email headers |
1,690,930,939,000 |
On AIX, I want the mail program to use /root/.mbox instead of default /root/mbox.
I edit mailrc
vim .mailrc
set MBOX=/root/.mbox
the result is not good
mail
Mail [5.2 UCB] [AIX 5.X] Type ? for help.
"/var/spool/mail/root": 2 messages 2 unread
>U 1 root Tue Jun 22 01:48 13/349
U 2 root Tue Jun 22 01:49 13/349
? 1
Message 1:
From root Tue Jun 22 01:48:58 2021
Date: Tue, 22 Jun 2021 01:48:58 +0200
From: root
To: root
hello
? q
Saved 1 message in /root/mbox
Held 1 message in /var/spool/mail/root
I have tried different setting like those on mailrc
set MBOX=/root/.mbox
set MBOX /root/.mbox
set mbox /root/.mbox
set mbox=/root/.mbox
but still save to /root/mbox
|
Solution found, instead of use this method, valid on old Unix os like Sco Unix System V
myname@scosysv:/usr/myname$ vi .mailrc
".mailrc" 1 line, 19 characters
set MBOX=/usr/myname/.mbox
myname@scosysv:/usr/myname$ echo hello|mail myname
myname@scosysv:/usr/myname$ mail
SCO System V Mail (version 3.2) Type ? for help.
"/usr/spool/mail/myname": 1 message 1 new
>N 1 myname Tue Jun 22 02:04 8/215
& 1
Message 1:
From myname Tue Jun 22 02:04:28 2021
From: [email protected] ()
X-Mailer: SCO System V Mail (version 3.2)
To: myname
Date: Tue, 22 Jun 2021 2:04:28 PDT
Message-ID: <[email protected]>
Status: R
hello
& save
"/usr/myname/.mbox"[New file] 8/215
& Held 0 messages in /usr/spool/mail/myname.
On AIX we use this method
export MBOX=/root/.mbox
echo hello|mail root
mail
Mail [5.2 UCB] [AIX 5.X] Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N 1 root Tue Jun 22 02:16 12/339
? 1
Message 1:
From root Tue Jun 22 02:16:25 2021
Date: Tue, 22 Jun 2021 02:16:25 +0200
From: root
To: root
hello
? save
"/root/.mbox" [Appended] 12/339
of course the variable can be added on .bashrc file or rc file of your shell.
| Aix: why program mail ignore the mbox setting? |
1,618,299,897,000 |
Say I have a PHP file with the following code line:
$to = "example-1_2@example-1_2.com";
I want to change only the email address between the two double quote marks to say [email protected]).
I have tried this which failed:
read new_email_address
sed -i 's/^[a-zA-Z0-9-_]*$@^[a-zA-Z0-9-_]*$.^[a-z]*$/"${new_email_address}"/g' FILE
|
Just a brief comment about the updated sed command in your question, which currently reads
sed -i 's/^[a-zA-Z0-9-_]*$@^[a-zA-Z0-9-_]*$.^[a-z]*$/"${new_email_address}"/g' FILE
Notice that this contains two invalid character ranges (both read 0-9-_) and that the variable new_email_address would not be expanded by the shell as it is in a single-quoted string. I'm also not sure about what the intention is with $@^ and $.^, as the $ and ^ would be matching those characters literally at those positions in the expression.
Not seeing how the $to variable is used in the rest of the file, I'm going to assume that it's only assigned to in one single place, and that the line that you show occurs exactly like it does in the file.
sed 's/$to = ".*";$/$to = "'"$new_email_address"'";/' file >file.new
There is no point in trying to match an email address since we know already that the $to variable holds an email address. The only thing we need to worry about is trying to find the correct line. Matching email addresses with regular expressions is notoriously difficult.
A few things to note here:
The $ in $to does not need special handling as it's not occurring last in the expression. If you use -E to enable extended regular expressions, then firstly, don't, and secondly, escape the $ in $to as \$ in the pattern.
The string $to will not be seen as a shell variable as it's within single quotes.
$new_email_address is a shell variable, so we're temporarily breaking out of the single quotes to introduce the value of that variable, double quoted.
I would suggest not using -i here, as you don't yet know whether the substitution does the right thing or whether it messes up the file. It's better to write the result to a fresh filename instead.
Also, with -ir, you are instructing sed to use r as the backup file suffix. I assume that you wanted to use the option -r (or -E, which would be more commonly supported). However, neither -r nor -E is needed as we're not using any extended regular expressions for this simple substitution.
Testing the above command:
$ cat file
$to = "example-1_2@example-1_2.com";
$ [email protected]
$ sed 's/$to = ".*";$/$to = "'"$new_email_address"'";/' file >file.new
$ cat file.new
$to = "[email protected]";
| How to change an email address to another directly inside a file? |
1,618,299,897,000 |
I'm running the latest Claws-Mail (v3.17.6) on Arch Linux and downloaded the latest hunspell-en_CA package (v2019.10.06). When I go to 'Configuration > Preferences > Spell Checking' the 'Default Dictionary' drop down has nothing in it.
I found the hunspell dictionary files are located in '/usr/share/hunspell/'. Is Claws-Mail looking in a different directory? Can I maybe link to these files?
Does anyone know how to get this working in Claw-Mail?
EDIT:
Here's the error message that I get when I compose or reply/forward to an email.
Spell checker could not be started. Couldn't initialize None dictionary: (null) Couldn't initialize None speller.
Thanks in advance!
|
I did everything that I could think of to get the new hunspell-en_CA package working with Claws-Mail. Nothing worked, but I did find that if you ditch the hunspell-en_CA package and load the aspell-en package everything will magically start to work. No need to run ./configure or anything... Just restart the application.
If need be, uncheck the checkbox Enable Spell Checker under Configuration > Preferences > Spell Checking click OK and go back in and re-check the box once again. The drop down should now show a list of english options.
| Claws-Mail Spell Checker Not Finding hunspell-en_CA |
1,618,299,897,000 |
I am setting up smtp to sent mails via terminal and getting "non-zero" status.
In my log files there is a log about "Unable to set AuthPassword"
password contains characters and numbers.
ssmtp.conf:
1 #
2 # Config file for sSMTP sendmail
3 #
4 # The person who gets all mail for userids < 1000
5 # Make this empty to disable rewriting.
6 [email protected]
7 [email protected]
8 AuthPassword=word12345
9 UseTLS=YES
10 UseSTARTTLS=YES
11
12 # The place where the mail goes. The actual machine name is required no
13 # MX records are consulted. Commonly mailhosts are named mail.domain.com
14 mailhub=smtp-mail.outlook.com:587
15
16 # Where will the mail seem to come from?
17 #rewriteDomain=
18 rewriteDomain=outlook.com
19
20 # The full hostname
21 [email protected]
22
23
24 # Are users allowed to set their own From: address?
25 # YES - Allow the user to specify their own From: address
26 # NO - Use the system generated From: address
|
From the man page for ssmtp.conf:
AuthPass
The password to use for SMTP AUTH.
You've configured ssmtp.conf with AuthPassword, which it doesn't appear to be expecting. Try it with the flag from the man page.
You should also redact passwords, at least in my opinion, when posting questions!
| "Unable to set AuthPassword" ssmtp |
1,618,299,897,000 |
I am running a website on two AWS EC2 instances running Ubuntu. I am using LAMP.
The following PHP code used to successfully send emails, to warn of suspicious activity, but stopped doing so in January 2020.
<?php
// Function to email notification of suspicious entry
function emailPossibleSQLInjectionNotification($ipAddress, $emailAddress, $field, $entry, $time)
{
$to = "[email protected]";
$subject = "Suspicious activity";
$message = "Dear Sir,\n\n" .
"The following invalid entry was entered for " . $field . ".\n\n" .
$field . ": " . $entry . "\n" .
"Client IP address" . ": " . $ipAddress . "\n" .
"Client email address" . ": " . $emailAddress . "\n" .
"Time" . ": " . $time . "\n\n" .
"Have a wonderful day!\nWeb Site Name.\n";
$from = "[email protected]";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
}
?>
The following
cat /var/log/mail.log
returns
Mar 5 00:30:41 ip-10-0-1-76 sm-mta[30561]: 02339OqL008906: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=1+21:21:17, xdelay=00:00:00, mailer=esmtp, pri=19290583, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
Mar 5 00:39:01 ip-10-0-1-76 sendmail[30620]: 0250d12h030620: from=root, size=550, class=0, nrcpts=1, msgid=<[email protected]>, bodytype=8BITMIME, relay=root@localhost
Mar 5 00:39:01 ip-10-0-1-76 sm-mta[30621]: 0250d14c030621: from=<[email protected]>, size=848, class=0, nrcpts=1, msgid=<[email protected]>, bodytype=7BIT, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Mar 5 00:39:01 ip-10-0-1-76 sendmail[30620]: 0250d12h030620: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30550, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (0250d14c030621 Message accepted for delivery)
Mar 5 00:39:01 ip-10-0-1-76 sm-mta[30622]: 0250d14c030621: to=<[email protected]>, ctladdr=<[email protected]> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31084, dsn=2.0.0, stat=Sent
Mar 5 00:40:41 ip-10-0-1-76 sm-mta[30576]: 023MRjPq024050: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=1+02:12:56, xdelay=00:10:36, mailer=esmtp, pri=7140592, relay=alt4.gmail-smtp-in.l.google.com. [172.217.218.26], dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
Mar 5 00:40:41 ip-10-0-1-76 sm-mta[30576]: 023H1exj022946: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=1+07:39:01, xdelay=00:00:00, mailer=esmtp, pri=9660592, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
Mar 5 00:40:41 ip-10-0-1-76 sm-mta[30576]: 02339OqL008906: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=1+21:31:17, xdelay=00:00:00, mailer=esmtp, pri=19380583, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
Mar 5 00:50:41 ip-10-0-1-76 sm-mta[30646]: 024KKwfi029723: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=04:29:43, xdelay=00:10:36, mailer=esmtp, pri=1290584, relay=alt4.gmail-smtp-in.l.google.com. [172.217.218.26], dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
Mar 5 00:50:41 ip-10-0-1-76 sm-mta[30646]: 023H1exj022946: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=1+07:49:01, xdelay=00:00:00, mailer=esmtp, pri=9750592, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
Mar 5 00:50:41 ip-10-0-1-76 sm-mta[30646]: 02339OqL008906: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=1+21:41:17, xdelay=00:00:00, mailer=esmtp, pri=19470583, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
Mar 5 01:00:41 ip-10-0-1-76 sm-mta[30660]: 023MRjPq024050: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=1+02:32:56, xdelay=00:10:36, mailer=esmtp, pri=7230592, relay=alt4.gmail-smtp-in.l.google.com. [172.217.218.26], dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
Mar 5 01:00:41 ip-10-0-1-76 sm-mta[30660]: 023H1exj022946: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=1+07:59:01, xdelay=00:00:00, mailer=esmtp, pri=9840592, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
Mar 5 01:00:41 ip-10-0-1-76 sm-mta[30660]: 02339OqL008906: to=<[email protected]>, ctladdr=<[email protected]> (33/33), delay=1+21:51:17, xdelay=00:00:00, mailer=esmtp, pri=19560583, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.
Mar 5 01:07:30 ip-10-0-1-76 sendmail[30700]: 02517Uj6030700: from=www-data, size=342, class=0, nrcpts=1, msgid=<[email protected]>, relay=www-data@localhost
Mar 5 01:07:30 ip-10-0-1-76 sm-mta[30701]: 02517UA4030701: from=<[email protected]>, size=583, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Mar 5 01:07:30 ip-10-0-1-76 sendmail[30700]: 02517Uj6030700: [email protected], ctladdr=www-data (33/33), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30342, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (02517UA4030701 Message accepted for delivery)
Mar 5 01:09:01 ip-10-0-1-76 sendmail[30846]: 025191nX030846: from=root, size=550, class=0, nrcpts=1, msgid=<[email protected]>, bodytype=8BITMIME, relay=root@localhost
Mar 5 01:09:01 ip-10-0-1-76 sm-mta[30847]: 025191Bc030847: from=<[email protected]>, size=848, class=0, nrcpts=1, msgid=<[email protected]>, bodytype=7BIT, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Mar 5 01:09:01 ip-10-0-1-76 sendmail[30846]: 025191nX030846: to=root, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30550, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (025191Bc030847 Message accepted for delivery)
Mar 5 01:09:01 ip-10-0-1-76 sm-mta[30848]: 025191Bc030847: to=<[email protected]>, ctladdr=<[email protected]> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31084, dsn=2.0.0, stat=Sent
The following
$ sudo netstat -ntlp | grep sendmail
returns
tcp 0 0 127.0.0.1:587 0.0.0.0:* LISTEN
1337/sendmail: MTA:
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
1337/sendmail: MTA:
An ISP would not be an issue since I am running the application from a AWS EC2 instance on the cloud.
I noticed that
df -i
returns
Filesystem Inodes IUsed IFree IUse% Mounted on
udev 124432 357 124075 1% /dev
tmpfs 126762 472 126290 1% /run
/dev/xvda1 917504 607710 309794 67% /
tmpfs 126762 1 126761 1% /dev/shm
tmpfs 126762 6 126756 1% /run/lock
tmpfs 126762 16 126746 1% /sys/fs/cgroup
tmpfs 126762 4 126758 1% /run/user/1000
so it is not an issue with inodes.
ps -e | grep sendmail
returns
1337 ? 00:00:08 sendmail-mta
4109 ? 00:00:00 sendmail-mta
4320 ? 00:00:00 sendmail-mta
The mail just does not show up, even to the spam folder.
Edit:
I also tried
ubuntu@ip-10-0-1-76:~$ sendmail [email protected]
Test
ubuntu@ip-10-0-1-76:~$
Still no mail shows up in my gmail account.
|
It was due to a change that AWS made. I fixed the problem as follows.
Installed, and set up Postfix as outlined here.
Edited AWS EC2
instance filter to allow SMTP on port 587.
Edited /etc/postfix/main.cf to include relayhost = [email-smtp.us-east-1.amazonaws.com]:587.
sudo postfix reload
| Mail sent, from PHP script,not showing up |
1,618,299,897,000 |
We have inherited a RHEL server and it is continually trying to send e-mails to defunct email aliases. Is there any way of finding out what program is sending the emails?
|
Look into the contents of e-mails. If they are sent to defunct aliases, they should be stuck in queue. RHEL usually uses sendmail, so queued e-mails should be in /var/spool/mqueue/. Look for the content of files there. That should give you a clue, what is sending them.
There can be many programs that can send e-mails. It can be (ana)crontabs. Look into /var/spool/cron/ to see what crontabs are running. It can be logwatch, or some other programs executed regularly. It can also be some daemon, although that is unlikely.
| How do I find what program is sending an email from a linux server |
1,618,299,897,000 |
How can I print Mutt Mail User Agent Inbox list in a text file?
That's my problem:
I need to print the Inbox files list, which have are with the following set:
set index_format="%4C %Z %{%d/%m/%y %H:%M} %s"
That way I need to print them in a text file, with the following example content:
10 N F 08/07/19 08:53 Attention: alarm(14286247:motion detection)
11 N F 08/07/19 08:53 Attention: alarm(14033396:motion detection)
12 N F 08/07/19 08:53 Attention: alarm(12063427:motion detection)
13 N F 08/07/19 08:52 Attention: alarm(14033396:motion detection)
14 N F 08/07/19 08:51 Attention: alarm(14033396:motion detection)
15 N F 08/07/19 08:51 Attention: alarm(14286247:motion detection)
16 N F 08/07/19 08:51 Attention: alarm(13809971:motion detection)
17 N F 08/07/19 08:49 Attention: alarm(14286247:motion detection)
18 N F 08/07/19 08:49 Attention: alarm(14033396:motion detection)
19 N F 08/07/19 08:48 Attention: alarm(14286247:motion detection)
20 N F 08/07/19 08:48 Attention: alarm(14033396:motion detection)
21 N F 08/07/19 08:48 Attention: alarm(12063427:motion detection)
22 N F 08/07/19 08:46 Attention: alarm(14033396:motion detection)
23 N F 08/07/19 08:47 Attention: alarm(13809971:motion detection)
24 N F 08/07/19 08:45 Attention: alarm(12063427:motion detection)
25 N F 08/07/19 08:45 Attention: alarm(14033396:motion detection)
26 N F 08/07/19 08:46 Attention: alarm(13809971:motion detection)
27 N F 08/07/19 08:44 Attention: alarm(14286247:motion detection)
28 N F 08/07/19 08:40 Attention: alarm(12063427:motion detection)
29 N F 08/07/19 08:39 Attention: alarm(14033396:motion detection)
30 N F 08/07/19 08:38 Attention: alarm(14033396:motion detection)
|
Instead of trying printing the Mutt Mail User Agent inbox, you should seek the mail files itself, they sometimes contains the timestamps too.
There is the NeoMutt documentations, which may help you:
https://neomutt.org/dev/documentation
| How can I print Mutt Mail User Agent Inbox list in a text file? |
1,618,299,897,000 |
I used fetchmail to access my Hotmail/Outlook mailbox. It downloaded every message inside Inbox, but now that folder is empty at the server. Now I see that fetchmail deletes messages by default:
-k | --keep : Keep retrieved messages on the remote mailserver. Normally, messages are deleted from the folder on the
mailserver after they have been retrieved. Specifying the keep option
causes retrieved messages to remain in your folder on the mailserver
I expected to find them in the Deleted folder or the Archive folder at the server but they are not there. Is there a way to find them (maybe something like a Imap/Deleted folder) or a way to reupload them?
|
Solved using Thunderbird:
Install Thunderbird
Link Hotmail account to Thunderbird using the same IMAP settings as in fetchmail
In Thunderbird install ImportExportTools extension
Create new folder in Local Folders, right click on the new folder, select ImportExportTools and import mbox file, select the user's mailbox file (e.g. /var/mail/myusername)
Drag the new local folder into the linked Hotmail account in Thunderbird, wait until all messages are uploaded back to the server
| Recover/reupload messages deleted by fetchmail |
1,618,299,897,000 |
I am trying to find out what mail service is being used to send voicemail to email on Centos 7 / FreePBX14 Distro.
|
The power of Google compelled me to find the blog for version 14, which led me to FreePDX Project and thence to Checking the Email Queue which showed it's postfix.
| Centos 7 / FreePBX14 Distro Email |
1,534,811,468,000 |
I need a way to slice everything after an email appears and before certain text appears.
Example formats are shown here:
[email protected]:0:3rw3e:weofkew:StackOverflow=
[email protected]:19.2132.1:StackOverflow=
Format needed would be:
[email protected]:StackOverflow= (followded by everything else on the line).
So essentially slicing after an email appears, and before StackOverflow= appears.
Notes: All emails are unique, it's not literally [email protected]
|
sed -r 's/(@[^:]+:).*(StackOverflow=)/\1\2/' input.txt
Explanation
sed -r 's/foo/bar/' input.txt: use sed with extended regular expressions, replacing pattern foo with bar, for file input.txt.
(@[^:]+:).*(StackOverflow=): match from the @ in the email address, which is followed by 1 or more non-: characters ([^:]+). This is then followed by a :. Capture this all in the first capturing groups with (). This is followed by a number of characters .*, then StackOverflow=, which we also capture in a group ().
/1/2: replace this expression with the partial email address (the first capturing group above), skip the part in between, then followed by the second capturing group.
N.B. this makes a lot of assumptions about the format of the input file, e.g. the format of the email address, the number of @ and StackOverflow= per line, etc.
| Slice between two strings (email + word) [closed] |
1,534,811,468,000 |
I have python script which sends email by shell function "mail". It runs fine. However, when I put in crontab to run it is unable to send mail to the recipient, rather it sends error message to my address. Is there any issue that crontab cannot send mail running via another script?
Here is my crontab entry:
30 8 * * * /home/akand/./pyscript.py
The pyscript.py has
import os
os.system(''' mail -s "Message" [email protected] <<< "Please
check ..." ''')
As I mentioned, pyscript.py runs fine.
|
As Jeff mentioned, the environment variable was not passing. The command in crontab:
30 8 * * * $HOME/.bash_profile; /home/akand/./pyscript.py
worked.
| Crontab mail issue |
1,534,811,468,000 |
I'd like to make sure a message, when deleted from an IMAP account (say on a locally installed server that I would manage) is safe deleted, i.e. filled with random data before being actually deleted. What I have in mind is a mail service installed on a Linux machine, which provides IMAP access.
Can that be implemented? (Or is it already?)
|
Theoretically it can be implemented (I am not aware of any current implementation), however it would be a moot point.
You are trying to provide a "secure wipe" function to ensure confidentiality of email messages; however, the message has already transited in plaintext through multiple mailservers from the sender to its final destination. Hence, its confidentiality cannot be ensured. It's like trying to strengthen a chain by reinforcing just one of its links.
If the email messages are instead encrypted end-to-end, there's no need for a "secure wipe" function.
| Can a "safe delete" be implemented for an IMAP server in Maildir mode? |
1,534,811,468,000 |
I've installed mail-in-a-box on Ubuntu 14.04 and I can't seem to find how to change Roundcube's logo.
Thank you
|
To convert nijave's comment into an answer, pulling from HowtoForge's How do I change the roundcube logo to my own? -- knowing that I don't have the software available to test this:
Edit the /etc/roundcube/config.inc.php file:
// replace Roundcube logo with this image
// specify an URL relative to the document root of this Roundcube installation
// an array can be used to specify different logos for specific template files, '*' for default logo
// for example array("*" => "/images/roundcube_logo.png", "messageprint" => "/images/roundcube_logo_print.png")
$config['skin_logo'] = "/images/roundcube_logo.png";
Where you've put the desired image in that path. Note that the path is relative to the Roundcube installation.
| Roundcube logo mail-in-a-box |
1,534,811,468,000 |
The maximum number of recipient for gmail is 500.
Is there any limit in the number of recipient using swaks?
swaks -t [email protected] -t [email protected] -t [email protected] [...]
|
The Gmail limit (n recipients per mail, m mails/day) is enforced on the SMTP server to prevent an user from spamming; it is not a hard limit due to the specific command Google uses to send mail. As such, using a command line tool to connect to Gmail SMTP server won't change this limit.
Note that passing 500 recipients to swaks (or to any other command) might fail due to the very long list of arguments, not because there's a limit in the number of recipients (which can easily be bypassed by sending 10 mails with 50 recipients each).
| Is there a limit in the number of recipient with swaks? |
1,534,811,468,000 |
My host (Kapsi ry internet society) changed the servers, after which I have not been able to read my emails, etc by mutt and host's webmail: all mailboxes seems to be empty.
I have done all proposed changes in mutt configs, but the problem has persisted now 3 weeks.
I can read no emails by mutt anymore.
Everything looks blank.
My host another email frontend also shows all mailbox blank.
The host says that some my mailbox still receives mails.
However, I cannot confirm it because I cannot view them.
I just need to read one email which has pdf attachment.
My host says the following but there is no $HOME/Maildir, only $HOME/mail and $HOME/Mail
According to procmail, your messages go to ~/Maildir directory.
Use these settings in `$HOME/.muttrc at https://dev.mutt.org/trac/wiki/MuttGuide/UseIMAP
Test viewing emails at https://webmail.host.com
My $HOME/.muttrc
# Automatically log in to this mailbox at startup
set spoolfile="imaps://username:[email protected]/INBOX"
# Define the = shortcut, and the entry point for the folder browser (c?)
set folder="imaps://mail.host.com/INBOX"
set record="=Sent"
set postponed="=Drafts"
set trash="=Trash"
# activate TLS if available on the server
set ssl_starttls=yes
# always use SSL when connecting to a server
set ssl_force_tls=yes
# Don't wait to enter mailbox manually
unset imap_passive
# Automatically poll subscribed mailboxes for new mail (new in 1.5.11)
set imap_check_subscribed
# Reduce polling frequency to a sane level
set mail_check=60
# And poll the current mailbox more often (not needed with IDLE in post 1.5.11)
set timeout=10
# keep a cache of headers for faster loading (1.5.9+?)
set header_cache=~/.hcache
# Display download progress every 5K
set net_inc=5
At $HOME, I can see where strange many msg... files and where I see that at least spam folder's timestamp updates most frequently (even today)
drwx------ 2 masi users 10 Jan 22 10:50 mail
drwx------ 2 masi users 2 Feb 13 2012 Mail
-rw------- 1 masi users 21894 Sep 19 2012 mbox
-rw------- 1 masi users 1929 Feb 19 11:03 msg.0ZE4C
-rw------- 1 masi users 2190 Feb 5 07:02 msg.1VGVF
-rw------- 1 masi users 2362 Jan 26 11:58 msg.2gVHF
-rw------- 1 masi users 2321 Jan 24 22:20 msg.-3ooE
-rw------- 1 masi users 3206 Feb 13 19:29 msg.40e4D
-rw------- 1 masi users 1508290 Mar 5 08:07 .spam
Hardware at server: HP DL 360 G7: 2x6-core Xeon @ 3,07 GHz, 144 GB ECC
OS: Linux 3.14.79 x86_64 GNU/Linux
|
The case is now resolved.
The technical support team did this for the resolution
add to the home directory .maildir_enable -file, which tels to the server Devecot about your use of Maildir -directory for mails
fixed .procmailrc -file such that spam goes to the right place in the right format - - there was a missing / -symbol at the "coordination" row formaatissa
put all wrongly directed mails to your mailbox
| How to troubleshoot reading emails after server upgrade? |
1,534,811,468,000 |
Is there a way to block connections for incoming requests for GMAIL at port level? Is it that all protocols use same port for incoming and outgoing connections?
|
Block incoming ports 25, 465 and 587. And you will have only outgoing mail from this server. Also you can consider to set the SMTP daemon to listen only to 127.0.0.1 which will make it accept incoming mail only via localhost and send mail to the world
| How to block a port connection (Ex: GMAIL) for incoming mails and allow only for outgoing mails? |
1,534,811,468,000 |
I use sendmail to manage the emails of my website. I'm testing features which require to send emails, and I'd like to receive these emails in a local directory of my server, store them as text files that I can read with vi for example.
I found a way to do this a few months earlier, the emails were stored in a specific folder with the recipient address as file name. Sadly, something went wrong with my virtual machine and I had to reconfigure the whole thing. The problem is that I don't remember what I had to do in order to get my emails in my local storage, and I can't find the solution again on internet, it makes me crazy. My virtual machine is on RHEL 6.
Thanks for your help !
|
I found how I did this the first time. It wasn't a sendmail configuration, but a piece of PHP code found here
It doesn't even use sendmail anymore, sendmail path is replaced with the PHP code path in php.ini file. The emails are stored in a specific folder with the addressee's address + random characters as filename.
| Sendmail : save email into a file |
1,534,811,468,000 |
I have installed fdm and offlineimap to connect to our corporate Exchange server. Now I want an action that marks a message read when a pattern matches.
|
I found a way to move and mark:
action "processed" maildir "%h/Mails/work/INBOX.Processed"
# Found here: https://github.com/nicm/fdm/blob/master/examples/f-terbeck.conf
action "mark-read" exec 'mf="%[mail_file]"; mv "${mf}" "${mf%%/*}/../cur/${mf##*/}:2,S"'
match "^From:.*test@xyz\.de" in headers actions { "processed" "mark-read" }
| fdm & msmtp: mark messages read |
1,534,811,468,000 |
If I need to set a /27 in the mentioned config file (sendmail), how can I do it? I need to write all the 30 IP's in it? Or does it accepts /27?
|
You have to write all the IP (or hostnames).
| How to set subnets in /etc/mail/relay-domains? |
1,534,811,468,000 |
using Cygwin on Windows 8, Quick Bash script to search server for files modified in the past 120 days:
Run once a week as a Cron job, But i cannot format the email.
All i want is a simple New Line:
data=$(find /cygdrive/g/SERVERPATH -mtime -120 -name "*.exe" -exec stat -c "%n : %y" {} \;) ; [[ -n "$data" ]] && email -s 'Servers Latest Files' [email protected] <<< "The following files have been detected as updated in the last 120 days <br> $data"
$Data Search from Grep.
All i want is to new Line between text and $Data
I tried using Echo -e or printf with no luck.
using simple /r does not work.
is it a matter of defining the email as HTML format and passing through as i am currently doing?
|
I answered my own question.
Simply writing down, normally dummys it enough for my brain to click in.
Pass HTML option and just use HTML formatting:
email -html -s
So for a working example:
data=$(find /cygdrive/g/SERVERPATH -mtime -120 -name "*.exe" -exec stat -c "%n : %y" {} \;) ; [[ -n "$data" ]] && email -html -s 'Servers Latest Files' [email protected] <<< "The following files have been detected as updated in the last 120 days <br> $data"
Sorry for posting this and wasting ones times
| Cygwin - Email - New Line (Carriage Return) (How to) |
1,534,811,468,000 |
To check whether Munin email notifications are still functioning, I have changed temporarily the "warning" and "critical" threshold to a very low value, and restarted the munin-node service.
To my dismay, I did not receive any Munin alert.
The Postfix service is running on port 25 and I can easily connect via telnet to it. I can send mail from command line -- and receive it correctly on my remote mailbox. /var/log/maillog contains references to the messages I sent from command line but nothing from Munin, so it appears that Munin is not sending any alert.
Is there any log that I could peruse to see what's wrong?
|
It appears the problem went away by itself after I reinstalled the ssmtp package.
I also modified the following line in /etc/munin/munin.conf so to include the full path to the mail binary:
contact.example.command /bin/mail -s "Munin alert" [email protected]
| Munin stopped sending email alerts |
1,534,811,468,000 |
I have a script that saves to DB content of piped to it file.
cat /mailpath/Maildir/cur/mailfile | php -q /scriptpath/mailPipe.php
I need a shell script or oneliner to find all files in Maildir, pipe them to php script and delete every file after that.
I know how to find and pipe every single file to PHP
find /mailpath/Maildir/cur/ -type f -printf "cat %p | php -q /scriptpath/mailPipe.php\n" | sh
But don't know how to delete files after—I don't won't to experiment with rm
P.S. If someone needs similar script: https://github.com/stuporglue/mailreader
|
This command should fails because the -delete is executed before the exec and also because in anycase your script only read input from stdin.
find /mailpath/Maildir/cur/ -type f -delete -exec php -q /scriptpath/mailPipe.php {} \;
I suggest you this one now :
find . -type f -exec sh -c "php -q /scriptpath/mailPipe.php < '{}'" \; -delete
Which produce this :
for i in `seq -w 1 10`; do echo $i > nonce-$i; done; ls
nonce-01 nonce-02 nonce-03 nonce-04 nonce-05 nonce-06 nonce-07 nonce-08 nonce-09 nonce-10
Executing the find :
find . -type f -exec sh -c "wc -l < '{}'" \; -delete ; ls
1
1
1
1
1
1
1
1
1
1
Can you try that ? (make a backup of /mailpath/Maildir/cur/ before)
It's an all in one command, without piping find with other commands, which can be pretty confusing.
It's even better because if the return of sh is error, then it won't delete the file at all, the order of command in find are dependent.
Also i really advise your to read this http://mywiki.wooledge.org/UsingFind
| Find mails, pipe them to php and delete after |
1,534,811,468,000 |
in Plesk (11.5) you can deactivate mail service on a specific domain. I did this, because:
At my domain provider I configured the domain DNS settings like this: A-record: IP points to web server with Plesk and Postfix. MX-record: Points still to the domain providers' mail servers (I don't want to use mail at the web server for this one domain).
I get an error message when try send a mail from this webserver with Plesk to an address of this domain which have an external mail server:
postfix/smtp[9444]: : to=<[email protected]>, relay=none, delay=1.2,
delays=1.1/0.02/0/0, dsn=5.4.6, status=bounced
(mail for mydomain.com loops back to myself)
When I try these command:
host -t mx mydomain.com
Then these message appears:
mydomain.com mail is handled by 10 mail.mydomain.com
But I would expect something like:
mydomain.com mail is handled by 10 ispmailserver.com
mydomain.com mail is handled by 20 ispmailserver2.com
Any further ideas what is wrong?
Thanks a lot.
|
Thanks to sebix.... I searched for a way to change the settings within Plesk 11.
So, under the "Domains" section:
Choose your domain and change the DNS MX settings to the external mail server. You can add a secondary record if more external mail servers exists and give them a priority.
Regards.
| mail delivery goes wrong with mx lookup |
1,534,811,468,000 |
I have a Intel NUC with an i3 processor running the latest Mint version with the Cinnamon desktop and already installed some basic services (Apache, MariaDb, ownCloud etc).
The next step would be to set up a mail server on the same box but I just recognized that most mail server which are considered as "easy to install and maintain" like iredmail consider a pretty fresh Linux environment without anything pre-installed (like web-server, database etc.).
Since I don't want to mess up my current installation but still would like to use the NUC as a 24/7 server which also hosts my mail in the future I was thinking about setting up the mail server inside a dedicated VM (with Qemu or Virtual Box).
The pros I see so far are the following:
Dedicated mail server where the installed components cannot interfere with other installed stuff
Easy backup since I can simply backup the complete VM
Easy "recovery-system" if hardware of NUC fails since I can easily run the backed up VM on another computer / OS until the hardware issues are solved (is this true?)
The cons:
24/7 running VM consumes probably more resources of the NUC than a direct install?
Is it basically a good idea to install the mail server in a dedicated VM or is there anything I forgot to consider?
|
Adding a mail server to an existing server should have no significant impacts. Other than resources required, the software will not interfere with other services. A few things to consider:
Do you have a static IP address? If not many servers will consider your email spammish.
Can you get the PTR record set to the sub-domain you will user for the mail server? If not your mail will be considered spammish.
Are you prepared to do spam filtering? It is common for up to 90% of received email to be spam.
Have you reviewed the relevant RFCs to understand what is expected of you as a mail server administrator?
Recommended Documentation:
Simple Mail Transfer Protocol RFC5321
Internet Messsaga Format RFC5322
Common DNS Operational and Configuration Errors RFC 1912 (Matching PTR and A records is now not common except for Mail servers.)
Anti-Spam Recommendations for SMTP MTAs RFC 2505
Message Header Field for Indicating Message Authentication Status RFC 5451
Sender Policy Framework RFC7208
Sender Policy Framework Site
DomainKeys Identified Mail (DKIM) Signatures RFC6376
Domain-based Message Authentication, Reporting, and Conformance RFC 7489
Domain-based Message Authentication, Reporting & Conformance Site
My blog post on Running an Email Server
My Email Policy
| Install mail server in VM |
1,426,372,498,000 |
I took a look at my postfix logs and I've noticed an odd occurrence lately: SMTP sessions that seem to end right after the RCPT TO, as such:
postfix/smtpd[11333]: > unknown[XXX.XXX.238.86]: 220 [mydomain.com] ESMTP (Ubuntu)
postfix/smtpd[11333]: < unknown[XXX.XXX.238.86]: EHLO LMSPC.[otherdomain.com]
postfix/smtpd[11333]: > unknown[XXX.XXX.238.86]: 250-[mydomain.com]
postfix/smtpd[11333]: > unknown[XXX.XXX.238.86]: 250-PIPELINING
postfix/smtpd[11333]: > unknown[XXX.XXX.238.86]: 250-SIZE 10240000
postfix/smtpd[11333]: > unknown[XXX.XXX.238.86]: 250-ETRN
postfix/smtpd[11333]: > unknown[XXX.XXX.238.86]: 250-STARTTLS
postfix/smtpd[11333]: > unknown[XXX.XXX.238.86]: 250-ENHANCEDSTATUSCODES
postfix/smtpd[11333]: > unknown[XXX.XXX.238.86]: 250-8BITMIME
postfix/smtpd[11333]: > unknown[XXX.XXX.238.86]: 250 DSN
postfix/smtpd[11333]: < unknown[XXX.XXX.238.86]: MAIL From:<tobyami@LMSPC.[otherdomain.com]>
postfix/smtpd[11333]: > unknown[XXX.XXX.238.86]: 250 2.1.0 Ok
postfix/smtpd[11333]: < unknown[XXX.XXX.238.86]: RCPT To:<[myusername]@[mydomain.com]>
For comparison, this is what a "normal" session looks like in my logs:
postfix/smtpd[31674]: > mail-wg0-f52.google.com[74.125.82.52]: 220 [mydomain.com] ESMTP (Ubuntu)
postfix/smtpd[31674]: < mail-wg0-f52.google.com[74.125.82.52]: EHLO mail-wg0-f52.google.com
postfix/smtpd[31674]: > mail-wg0-f52.google.com[74.125.82.52]: 250-[mydomain.com]
postfix/smtpd[31674]: > mail-wg0-f52.google.com[74.125.82.52]: 250-PIPELINING
postfix/smtpd[31674]: > mail-wg0-f52.google.com[74.125.82.52]: 250-SIZE 10240000
postfix/smtpd[31674]: > mail-wg0-f52.google.com[74.125.82.52]: 250-ETRN
postfix/smtpd[31674]: > mail-wg0-f52.google.com[74.125.82.52]: 250-ENHANCEDSTATUSCODES
postfix/smtpd[31674]: > mail-wg0-f52.google.com[74.125.82.52]: 250-8BITMIME
postfix/smtpd[31674]: > mail-wg0-f52.google.com[74.125.82.52]: 250 DSN
postfix/smtpd[31674]: < mail-wg0-f52.google.com[74.125.82.52]: MAIL FROM:<[whatever]@gmail.com> SIZE=1774
postfix/smtpd[31674]: > mail-wg0-f52.google.com[74.125.82.52]: 250 2.1.0 Ok
postfix/smtpd[31674]: < mail-wg0-f52.google.com[74.125.82.52]: RCPT TO:<[my username]@[mydomain.com]>
postfix/smtpd[31674]: > mail-wg0-f52.google.com[74.125.82.52]: 250 2.1.5 Ok
postfix/smtpd[31674]: < mail-wg0-f52.google.com[74.125.82.52]: DATA
postfix/smtpd[31674]: > mail-wg0-f52.google.com[74.125.82.52]: 354 End data with <CR><LF>.<CR><LF>
postfix/smtpd[31674]: > mail-wg0-f52.google.com[74.125.82.52]: 250 2.0.0 Ok: queued as 6346912215C
postfix/smtpd[31674]: < mail-wg0-f52.google.com[74.125.82.52]: QUIT
postfix/smtpd[31674]: > mail-wg0-f52.google.com[74.125.82.52]: 221 2.0.0 Bye
It seems my server doesn't answer with an "Ok" once it gets a RCPT TO in the first case. Things just seem to...stop.
It doesn't bother me too much since I still get mails, and occurrences like the former example seem to all come from IPs either without a reverse DNS or from "weird" domains; as such, I'm assuming they must be spam attempts.
Still, I'm wondering what's happening here. I can't tell who's dropping the connection first, my server or the remote, nor can I tell why the connection would be dropped. If it's on my end, why is it dropped at this point, after the RCPT TO, and not before? If it's on the remote end, why drop it before sending anything, or even before letting my server respond?
EDIT: It seems because smtpd was in verbose mode, it wasn't logging everything, ironically. After disabling verbose mode, I see it's actually rejecting those right after the RCPT TO. Why it wasn't logging that when it was told to be verbose is beyond me, though.
|
It can be for a number of different reasons.
I used to run these tests to see whether a mail server was configured properly (was it setup to accept mail for that particular domain. I had occurences when new mail servers weren't setup properly and then people complained that they hadn't received mail only to realise that they had misconfigured their won systems so I decided to do these tests from then on) prior to cutover on a mail server change.
From a SPAM perspective it can be used to test whether the system is setup as an open relay (misconfigured) allowing for anyone to send email to anyone out on the Internet.
http://en.wikipedia.org/wiki/Open_mail_relay
From a security/intelligence perspective it can be used to determine whether a particular person still works with a firm by determining whether the email address is still present at a firm.
The only other time when I've seen this type of anomaly is with improperly setup security devices, bugs within devices/software, bizarre DoS attacks, and also hardware failure.
| postfix logs: SMTP sessions stopping after RCPT TO |
1,426,372,498,000 |
For example, the server I am using uses the host name "A.com". Now, I want to send an email to "[email protected]". But the email server isn't on this server. How can I do this?
|
This has nothing to do with Unix. You need to set an MX record in DNS for a.com. This record points to the name of the host which handles the mail for this domain. If there is no MX record for the target domain then the host a.com itself is tried for delivery.
You can check that with host -t A google.com vs. host -t MX google.com.
| How can I do to use a email service for a same domain on other server [closed] |
1,426,372,498,000 |
I asked some time ago a question Send emails with a custom From: field
However, still can't get exim4 running. It does send emails, but it is unable to receive any. I'm quite sure this might be because of mail server name and MX configuration.
In my control panel I can set Preference, TTL, and Mail Server values for MX. I leave two first ones as default (0, 6400), and the Mail Server I set to "url.com" (I substituted my domain name with "url" name).
But when I send an email to myself, I get:
Unroutable address
in the main log.
When I run from my linux console " host -t mx url.com" I get:
;; connection timed out; no servers could be reached
It seems like my MX had no effect at all? What can I do to get it work?
I am very noobie in the subject and even not sure what does "Mail server" refer to? Is it the name that I get by command "host", or maybe "host -f", or maybe "host -i", or maybe even something else? I'm really confused. :/
Here's /etc/exim4/update-exim4.conf.conf content:
# /etc/exim4/update-exim4.conf.conf
#
# Edit this file and /etc/mailname by hand and execute update-exim4.conf
# yourself or use 'dpkg-reconfigure exim4-config'
#
# Please note that this is _not_ a dpkg-conffile and that automatic changes
# to this file might happen. The code handling this will honor your local
# changes, so this is usually fine, but will break local schemes that mess
# around with multiple versions of the file.
#
# update-exim4.conf uses this file to determine variable values to generate
# exim configuration macros for the configuration file.
#
# Most settings found in here do have corresponding questions in the
# Debconf configuration, but not all of them.
#
# This is a Debian specific file
dc_eximconfig_configtype='internet'
dc_other_hostnames='url.com; mail.url.com; url; localhost; localhost.localdomain'
dc_local_interfaces='127.0.0.1; my_ip'
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='true'
dc_hide_mailname=''
dc_mailname_in_oh='true'
dc_localdelivery='maildir_home'
For any case, I substituted my domain with url and ip with my_ip.
And /etc/email-addresses is very short:
root: [email protected]
And /etc/mailname
url.com
Update: When I do from Windows:
nslookup -type=mx url.com
I get something like:
Server: UnKnown
Address: probably_my_internet_provider's_gate_ip
Non-authoritative answer
url.com MX preference = 0, mail exchanger = url.com
Update 2:
Now I really am confused. I tried to run "dig mx url.com" and "host -t mx url.com" from the other mail linux server (not mine), and it seems to be ok, e.g. the last one results in:
url.com mail is handled by 0 url.com
But where are my e-mails then?? I can't see in ~/Maildir anything. And when I run "mail" I get msg that there's "No mail for root". So does it work, or it doesn't... or what?
Update 3: IS THIS A ROUTING PROBLEM?
Now I can see that when I'm trying to send an e-mail from [email protected], it fails with the following message:
"Unroutable adress"
concerning the [email protected] address (so it's not the target "TO" one, but the "FROM" one). It didn't happen before (say a month ago), so I probably messed up some config. :/
When I do, as suggested by some net tutorial:
exim4 -d -bt mail
I get a lot of different "routers" (I'm not even sure if I do understand them properly, though I've read a section in the exim4 documumentation), specifically:
hubbed_hosts router ("router skipped: domains mismatch")
dnslookup_relay_to_domains router ("router skipped: domains mismatch")
dnslookup router ("router skipped: domains mismatch")
real_local router ("router skipped: prefix mismatch")
system_aliases router ("system_aliases router declined for [email protected]")
userforward router ("router skipped: file check")
procmail router ("router skipped: file check")
maildrop router ("router skipped: file check")
lowuid_aliases router ("router skipped: condition failure")
local_user router (see below):
The last one ends with quite a long response:
--------> local_user router <--------
local_part=mail domain=url.com
checking domains
cached yes match for +local_domains
cached lookup data = NULL
url.com in "+local_domains"? yes (matched "+local_domains" - cached)
checking local_parts
mail in "! root"? yes (end of list)
checking for local user
seeking password data for user "mail": using cached result
getpwnam() succeeded uid=8 gid=8
R: local_user for [email protected]
calling local_user router
local_user router called for [email protected]
domain = url.com
set transport maildir_home
queued for maildir_home transport: local_part = mail
domain = url.com
errors_to=NULL
domain_data=NULL localpart_data=NULL
routed by local_user router
envelope to: [email protected]
transport: maildir_home
[email protected]
router = local_user, transport = maildir_home
search_tidyup called
>>>>>>>>>>>>>>>> Exim pid=31821 terminating with rc=0 >>>>>>>>>>>>>>>>
I wonder now, why does it use "[email protected]", not "[email protected]" here? Is this something normal?
And foremost: Which ROUTER is the one I should be interested in my case, that is when I'm attempting to send a message with (now) a "mail" command from the command line to the foreign e-mail address?
|
Solved. Thanks for all your suggestions. The problem was connected to Name Servers, and after all they now correctly resolve names.
| Mail - server name issues? |
1,426,372,498,000 |
I am using fetchmail in combination with procmail for mail filtering on CentOS where my mail contains various log messages.
They serve me so I could search through my mail(logs) for error strings.
So does anyone haves an idea how could I check if one mail is missing because I have a fixed number of mail sent to me every day, and if a server crashes obviously it won't send the mail, how can I determine if a mail is missing and if it is to send an alert through email?
When I get my mail with fetchmail and process it with procmail I need to look through procmail.log file so I could determine if a certain mail hasn't arrived. My log file looks like this:
From [email protected] Wed Dec 31 10:38:49 2014
Subject: example1 -> Incremental 1 -> DEV backup
Folder: /dev/null 235603
From [email protected] Wed Dec 31 10:38:50 2014
Subject: example2
Folder: /dev/null 5983
From [email protected] Wed Dec 31 10:38:50 2014
Subject: example3 -> Full Offline Backup DEV
Folder: /dev/null 40978
From [email protected] Wed Dec 31 10:38:50 2014
Subject: [OK] [ example4]
Folder: /dev/null
So these mails are received during a day, and they must be there at a certain time when I need to check if every mail has arrived (exists in the log file). Now I need a way to see if each of these mails are present in the log. And it can be searched just by the from line.
|
You can run a periodic log analyzer of some sort to verify that you have received everything you expect to receive. Perhaps something like this.
awk 'BEGIN {
e="[email protected]:[email protected]:[email protected]:[email protected]";
split(e, expected, /:/) }
/^From / { seen[$2]++ }
END { for (x in expected) if (!(expected[x] in seen)) print expected[x] " missing" }
' Mail/procmail.log
Make sure you have a log from the period of time you want to check (last 24 hours?) and pass it to this script. If one of the "expected" records is missing, it will alert.
The script simply looks for the second field of each From log line and extracts it into seen. At the end, if there are records in expected which are not in seen, issue an alert message for each.
You could run this out of your crontab to have an email delivered to you if the script generates any output. It would make sense to run this in conjuction with a log rotation script so that you archive and process your latest log file (at least roughly) at the same time. Then you don't need to parse time stamps in the log file, etc; anything which is in this log file is for the period you are interested in.
| Checking if a mail has arrived, if not then alert |
1,426,372,498,000 |
I have installed POSTFIX over Squirrelmail on CentOS Linux...
The services I have ran are:
service httpd
service ssl
service mysql
service postfix
service saslauthd
service dovecot
But I want to know :
How can I send mail but nothing go to my sentbox?
|
Just you should know a trick...
you can do:
cd /home/bobby/Maildir && chmod -w .Sent/
That works!!!
| Disabling sentbox in postfix over Squirrelmail |
1,426,372,498,000 |
Using this script to pull the command out lines from the text file and sending to email in table format. Need to know how to make the multiple rows (as single command has multiple lines of out) to put in a single cell using awk.
Script used:
tmpfile="/tmp/test.html"
input="/tmp/test.txt"
{
echo '<table border=1 cellspacing=0 cellpadding=3>'
awk 'NR==1 {print "<tr><td>Hostname</td><td>"$0"</td></tr>"}' "$input"
awk 'NR==2,NR==5 {print "<tr><td>IPAddress</td><td>"$0"</td></tr>"}' "$input"
awk 'NR==6{print "<tr><td>Date</td><td>"$0"</td></tr>"}' "$input"
echo '</table>'
} >"$tmpfile"
Text file: cat /tmp/test.txt - lines 2 to 5 has output of a single command.
machinename.domain
ens00: flags=00
inet 00.00.00.00 netmask 00.00.00.0 broadcast
ether 00:00:00:00:00:00 txqueuelen 000 (Ethernet)
RX packets 97 bytes 61809
currentdate
Excepted out in email table format
Hostname machinename.domain
IPAddress ens00: flags=00
inet 00.00.00.00 netmask 00.00.00.0 broadcast
ether 00:00:00:00:00:00 txqueuelen 000 (Ethernet)
RX packets 97 bytes 61809
Date currentdate
Current Output in table format
Hostname machinename.domain
IPAddress ens00: flags=00
IPAddress inet 00.00.00.00 netmask 00.00.00.0 broadcast
IPAddress ether 00:00:00:00:00:00 txqueuelen 000 (Ethernet)
IPAddress RX packets 97 bytes 61809
Date currentdate
|
This might be what you're trying to do, using any awk:
$ cat tst.sh
#!/usr/bin/env bash
tmpfile='test.html'
input='test.txt'
awk '
BEGIN {
print "<table border=1 cellspacing=0 cellpadding=3>"
}
NR == 1 {
print "<tr><td>Hostname</td><td>" $0 "</td></tr>"
}
NR == 2 {
print "<tr><td valign=\"top\">IPAddress</td><td>" $0
}
(2 < NR) && (NR < 6) {
print "<br>" $0
}
NR == 6 {
print "</td></tr>"
print "<tr><td>Date</td><td>" $0 "</td></tr>"
}
END {
print "</table>"
}
' "$input" > "$tmpfile"
$ ./tst.sh
$ cat test.html
<table border=1 cellspacing=0 cellpadding=3>
<tr><td>Hostname</td><td>machinename.domain</td></tr>
<tr><td valign="top">IPAddress</td><td>ens00: flags=00
<br>inet 00.00.00.00 netmask 00.00.00.0 broadcast
<br>ether 00:00:00:00:00:00 txqueuelen 000 (Ethernet)
<br>RX packets 97 bytes 61809
</td></tr>
<tr><td>Date</td><td>currentdate</td></tr>
</table>
When rendered by a browser that table would look like the following, which I think is what you want:
| Using awk to pull multiple rows from a txt file and put it a single cell in html |
1,426,372,498,000 |
I wanted to save mail in unix in some directory, as we do in outlook (files are saved with .msg extensions). Is there any workaround for doing this.
|
you can use save command:
save [msglist] /YourDir/file
this command will append messages to file.
or you can use pine: (http://www.washington.edu/pine/tutorial.4/index.html#SavingMsg)
To save a message to your saved-messages folder:
At the Message Index screen, use the arrow keys to highlight the message you want to save, or, at the Message Text screen as you view a message, press S (Save). You are asked if you want to save the message to the saved-messages folder or to another folder:
SAVE to folder in <Mail...> [saved-messages]:
Press <Return> to choose the default folder: [saved-messages]. Pine saves your message, and you see the following:
[Message # copied to "saved-messages" in <Mail...> and deleted]
| How to save mails in Unix? [closed] |
1,426,372,498,000 |
I'm trying to send emails programmatically with Python. The emails stay in the mail queue (mailq). Details are below.
My diagnosing abilities have reached their limit. Perhaps the issue is my ISP blocking outgoing emails from my (dynamic) IP address. Perhaps Gmail and Yahoo are expecting a different port or protocol.
Technical setup:
Debian 4.8.4-1
exim4 (reconfigured using # dpkg-reconfigure exim4-config; how do I reset to defaults?)
Python 2.7.9
Debian PC --> router --> WAN
Python emailer script
#!/usr/bin/env python
import cgi
from email.MIMEImage import MIMEImage
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
import mimetypes
import multiprocessing
import os
import smtplib
import sys
import traceback
to_addr = "<me>@gmail.com"
from_addr = "<me>@gmail.com"
body_text = "auto email test"
message = MIMEText(body_text)
message["Subject"] = "subject"
message["From"] = from_addr
message["To"] = to_addr
message["Return-Path"] = "<>"
message["Auto-Submitted"] = "auto-generated"
smtp = smtplib.SMTP("localhost")
#smtp = smtplib.SMTP("localhost", 587)
#smtp = smtplib.SMTP("localhost", 666)
#smtp = smtplib.SMTP("localhost", 25)
try:
print("sending email")
smtp.sendmail(from_addr, [to_addr], body_text)
print("sent email")
except Exception, em:
print("ERROR: " + str(em) )
except SMTPException, em:
print("ERROR: " + str(em) )
smtp.quit()
Python script output (no port specified, or port 25 specified)
root@deb:/****/****/****# python emailer.py
sending email
sent email
Here is the email, stuck in the mail queue:
root@deb:/****/****/****# mailq
5m 266 1aFMdt-0002d6-KW <>
<me>@gmail.com
Python script output (using port 587, or port 666) ~ In this case, mailq is empty
root@mypc:/****/****/****# python emailer.py
Traceback (most recent call last):
File "emailer.py", line 51, in <module>
smtp = smtplib.SMTP("localhost", 666)
File "/usr/lib/python2.7/smtplib.py", line 256, in __init__
(code, msg) = self.connect(host, port)
File "/usr/lib/python2.7/smtplib.py", line 316, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket
return socket.create_connection((host, port), timeout)
File "/usr/lib/python2.7/socket.py", line 571, in create_connection
raise err
socket.error: [Errno 111] Connection refused
exim4 log output (/var/log/exim4/mainlog)
2016-01-02 08:54:49 1aFMdt-0002d6-KW <= <> H=localhost (deb.home) [127.0.0.1] P=esmtp S=266
2016-01-02 08:56:57 1aFMdt-0002d6-KW gmail-smtp-in.l.google.com [74.125.203.26] Connection timed out
2016-01-02 08:56:57 1aFMdt-0002d6-KW == <me>@gmail.com R=dnslookup T=remote_smtp defer (110): Connection timed out
|
You can check if you have access to the mail relay by doing e.g.
nc mailrelay 25
I'd strongly suspect your ISP blocks outgoing mail traffic (there is just way too much spam on the net already, by some estimates fully 95% of all email traffic)
| Why are my emails generated with Python stuck in mail queue |
1,426,372,498,000 |
I have postfix installed on a development box and I used the parameters from this other posting to configure postfix to work on localhost only. But the other posting does not explain how to send emails or view received emails from the command line. I have higher level code for sending/receiving smtp email, but I want to be able to do it from the command line first in order to validate the postfix is working before I start testing the higher level code. I have made several tries and seem to be sending emails, but I cannot find the emails that have been sent. How can I confirm that the emails have been sent and also read the emails from the command line?
EDIT#1:
I typed MAIL=/home/root/Maildir in the terminal then hit return, then typed mail and hit return. I did this in the root account and again in the username account. This showed a list of old emails in the root account, so I logged into the username account and typed the following to send an email from username to root:
sendmail root@localhost <<EOF
subject:This is a test
from:username@localhost
Body message here...
EOF
The preceding code resulted in another command prompt with no error. But when I logged back into root and typed mail again to check mail, the new email was not listed along with the old emails.
Also, main.cf is as follows:
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myorigin = localhost
inet_interfaces = localhost
inet_protocols = all
unknown_local_recipient_reject_code = 550
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
relayhost =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
mailbox_command =
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.10.1/samples
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
What am I doing wrong?
EDIT#2:
After IanMcGowan's suggestions, I checked to see that mailx was already installed. I then used this tutorial to test sending and receiving emails using the mailx commands, but I am not able to read the newly send emails either. I think it is a configuration problem. I am using email addresses like root@localhost and username@localhost.
telnet localhost 25 results in:
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost.localdomain ESMTP Postfix
nano /var/log/maillog contains:
Jan 5 12:09:40 localhost postfix/postfix-script[6162]: starting the Postfix mail system
Jan 5 12:09:40 localhost postfix/master[6164]: daemon started -- version 2.10.1, configuration /etc/postfix
Jan 5 12:46:00 localhost postfix/postfix-script[3036]: starting the Postfix mail system
Jan 5 12:46:00 localhost postfix/master[3047]: daemon started -- version 2.10.1, configuration /etc/postfix
Jan 5 13:12:02 localhost postfix/smtpd[4642]: connect from localhost.localdomain[127.0.0.1]
Jan 5 13:12:02 localhost postfix/smtpd[4642]: DB1249A618: client=localhost.localdomain[127.0.0.1]
Jan 5 13:12:02 localhost postfix/cleanup[4645]: DB1249A618: message-id=<1738078707.0.1420492322780.JavaMail.username@localhost.localdomain>
Jan 5 13:12:02 localhost postfix/qmgr[3058]: DB1249A618: from=<[email protected]>, size=632, nrcpt=1 (queue active)
Jan 5 13:12:02 localhost postfix/smtpd[4642]: disconnect from localhost.localdomain[127.0.0.1]
Jan 5 13:12:02 localhost postfix/local[4646]: DB1249A618: to=<[email protected]>, orig_to=<root@localhost>, relay=local, delay=0.11, delays=0.06/0.02/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
Jan 5 13:12:02 localhost postfix/qmgr[3058]: DB1249A618: removed
Jan 5 14:29:20 localhost postfix/pickup[5207]: 7F4439A616: uid=1000 from=<username>
Jan 5 14:29:20 localhost postfix/cleanup[5266]: 7F4439A616: message-id=<[email protected]>
Jan 5 14:29:20 localhost postfix/qmgr[3058]: 7F4439A616: from=<[email protected]>, size=334, nrcpt=1 (queue active)
Jan 5 14:29:20 localhost postfix/local[5271]: 7F4439A616: to=<[email protected]>, orig_to=<root@localhost>, relay=local, delay=0.13, delays=0.1/0.01/0/0.02, dsn=2.0.0, status=sent (delivered to maildir)
Jan 5 14:29:20 localhost postfix/qmgr[3058]: 7F4439A616: removed
Jan 5 14:57:10 localhost postfix/pickup[5207]: A21B49A618: uid=0 from=<root>
Jan 5 14:57:10 localhost postfix/cleanup[5529]: A21B49A618: message-id=<[email protected]>
Jan 5 14:57:10 localhost postfix/qmgr[3058]: A21B49A618: from=<[email protected]>, size=534, nrcpt=1 (queue active)
Jan 5 14:57:10 localhost postfix/local[5531]: A21B49A618: to=<[email protected]>, orig_to=<root>, relay=local, delay=0.38, delays=0.34/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
Jan 5 14:57:10 localhost postfix/qmgr[3058]: A21B49A618: removed
Jan 5 15:47:38 localhost postfix/pickup[5207]: F312D9A618: uid=0 from=<root>
Jan 5 15:47:39 localhost postfix/cleanup[5975]: F312D9A618: message-id=<[email protected]>
Jan 5 15:47:39 localhost postfix/qmgr[3058]: F312D9A618: from=<[email protected]>, size=458, nrcpt=1 (queue active)
Jan 5 15:47:39 localhost postfix/local[5977]: F312D9A618: to=<[email protected]>, orig_to=<username@localhost>, relay=local, delay=0.12, delays=0.09/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
Jan 5 15:47:39 localhost postfix/qmgr[3058]: F312D9A618: removed
Jan 5 15:48:20 localhost postfix/pickup[5207]: A826C9A618: uid=1000 from=<username>
Jan 5 15:48:20 localhost postfix/cleanup[5975]: A826C9A618: message-id=<[email protected]>
Jan 5 15:48:20 localhost postfix/qmgr[3058]: A826C9A618: from=<[email protected]>, size=461, nrcpt=1 (queue active)
Jan 5 15:48:20 localhost postfix/local[5977]: A826C9A618: to=<[email protected]>, orig_to=<username@localhost>, relay=local, delay=0.11, delays=0.08/0/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
Jan 5 15:48:20 localhost postfix/qmgr[3058]: A826C9A618: removed
Jan 5 15:48:29 localhost postfix/pickup[5207]: 54AA19A618: uid=1000 from=<username>
Jan 5 15:48:29 localhost postfix/cleanup[5975]: 54AA19A618: message-id=<[email protected]>
Jan 5 15:48:29 localhost postfix/qmgr[3058]: 54AA19A618: from=<[email protected]>, size=461, nrcpt=1 (queue active)
Jan 5 15:48:29 localhost postfix/local[5977]: 54AA19A618: to=<[email protected]>, orig_to=<root@localhost>, relay=local, delay=0.11, delays=0.09/0/0/0.02, dsn=2.0.0, status=sent (delivered to maildir)
Jan 5 15:48:29 localhost postfix/qmgr[3058]: 54AA19A618: removed
Jan 5 15:52:03 localhost postfix/pickup[5207]: C756E9A618: uid=0 from=<root>
Jan 5 15:52:03 localhost postfix/cleanup[6074]: C756E9A618: message-id=<[email protected]>
Jan 5 15:52:03 localhost postfix/qmgr[3058]: C756E9A618: from=<[email protected]>, size=491, nrcpt=1 (queue active)
Jan 5 15:52:03 localhost postfix/local[6076]: C756E9A618: to=<[email protected]>, orig_to=<root@localhost>, relay=local, delay=0.13, delays=0.09/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
Jan 5 15:52:03 localhost postfix/qmgr[3058]: C756E9A618: removed
Jan 5 16:02:36 localhost postfix/smtpd[6213]: connect from localhost.localdomain[127.0.0.1]
Jan 5 16:04:26 localhost postfix/smtpd[6213]: disconnect from localhost.localdomain[127.0.0.1]
The logs say delivered to maildir. Am I using the wrong syntax to access maildir contents? If so, what is the correct syntax? Or is the problem in main.cf above?
EDIT#3
I typed nano /var/spool/mail/root and was able to view the old emails that show up when I log in as root and type mail or mailx. But the new emails are not located there. These emails are automated and seem to be relics from before postfix was configured to use /Maildir structure.
|
Unless you have a specific requirement to move your mail store; simply restore the configuration to the defaults.
That setup stores your emails in /var/spool/mail/<username> instead of your home which means any MUA you install will know where to find it without any reconfiguration.
| unable to view postfix email from centos 7 command line, why not? |
1,426,372,498,000 |
On Debian LAMP with different PHP based CMSs I use the MTA sSMTP to send email via an email proxy (Gmail); the emails I send are only contact-form inputs transferred from any such CMS to my own email account:
CMS contact-form input → Eail proxy (Gmail) → Main email account I use (also Gmail)
My sSMTP conf looks similar to this:
#!/bin/bash
set -eu
read -p "Please paste your Gmail proxy email address: " \
gmail_proxy_email_address
read -sp "Please paste your Gmail proxy email password:" \
gmail_proxy_email_password && echo
cat <<-EOF > /etc/ssmtp/ssmtp.conf
root=${gmail_proxy_email_address}
AuthUser=${gmail_proxy_email_address}
AuthPass=${gmail_proxy_email_password}
hostname=${HOSTNAME:-$(hostname)}
mailhub=smtp.gmail.com:587
rewriteDomain=gmail.com
FromLineOverride=YES
UseTLS=YES
UseSTARTTLS=YES
EOF
As you can see a file named /etc/ssmtp/ssmtp.conf will be created and will contain the email address and its account's password.
If the unlikely happens and an hacker finds out the email address and password I could be in a lot of trouble in cases I store payment information (I don't, I never did, and not planning to but still, it should be taken seriously).
How could I protect the aforementioned file? Maybe encrypting it somehow?
As of the moment I don't want to use an email server with configuring email DNS records, etc.
|
ssmtp has to use your login and password to send the mail. If it would be encrypted, ssmtp would have to decrypt it, so the hacker could do the same.
The file /etc/ssmtp/ssmtp.conf should have only the necessary permissions to allow ssmtp to access the file and you should secure your system to prevent unauthorized access.
See https://wiki.archlinux.org/index.php/SSMTP:
Because your email password is stored as cleartext in /etc/ssmtp/ssmtp.conf, it is important that this file is secure. By default, the entire /etc/ssmtp directory is accessible only by root and the mail group. The /usr/bin/ssmtp binary runs as the mail group and can read this file. There is no reason to add yourself or other users to the mail group.
If you use an app password (see also the web page referenced above) the credentials should not be usable for interactive login.
| Protecting an email-proxy (Gmail) account being used by a Mail Transfer Agent (MTA) |
1,426,372,498,000 |
I have this spamassassin implementation where I lowered the score on:
KHOP_BIG_TO_CC
It works when I override the score in my /etc/mail/spamassassin/local.cf file but I cannot find the .cf file that holds this specific rule.
Checked both the locations where rules are kept:
/usr/share/spamassassin
/etc/mail/spamassassin
And also some local users home folder like
/root/.spamassassin/
/var/amavisd/.spamassassin/
Did a grep on the directories like this:
grep -r "KHOP_BIG_TO_CC" /<directory/path/*
but nothing, I find other KHOP rules but never this one although it shows up in the xspam headers.
Now I have read somewhere that there exists an khop channel:
http://khopesh.com/wiki/Anti-spam
however, the only channel I read with sa-update is "sought.rules.yerp.org"
Does anyobody recognize the KHOP_BIG_TO_CC rule and knows where i can find it?
|
I don't know the answer about KHOP_BIG_TO_CC, but here's some tips for exploring your server:
You can view which rule files are being loaded by spamassassin with this command:
spamassassin --lint -D 2>&1 | grep 'config: read file'
On a RHEL 6 system using sa-update I found the rule sets under /var/lib/spamassassin. You can grep all cf files with:
grep KHOP_BIG_TO_CC $(spamassassin --lint -D 2>&1 | grep 'config: read file' | sed 's/^.* read file //')
On my system no KHOP_ rules were found.
Not likely, but perhaps it is possible, depending on how your system is setup, for individual users to define their own spamassassin rules, in which case they might be under something like $HOME/.spamassassin/user_prefs? In this case the --lint -D command above wouldn't display all parsed user rules.
But regardless of where KHOP_BIG_TO_CC is defined, you can override the score used by it by adding the following to your local.cf file:
score KHOP_BIG_TO_CC 0.0
You wouldn't be editing core rule files anyways, so it doesn't really matter where they are found (although I can understand the frustration of not being able to find the file where it is defined).
| where are the spamassassin KHOP rules? |
1,426,372,498,000 |
mailto: .. attach= is not working for firefox nor chrome, so can't email a .klm file from Google Earth?
I love having Google Earth on Debian, but when I try to email a .klm view file using File | Email | Email view...
and select web browser mailto: handler:
I get the following error message:
I'm not seeing this error message in Windows 10. Instead it creates the email as expected with the attachment.
Here's what I've already tried to fix this:
1) Fixed the environment (a couple of places to be sure):
# cat /etc/environment
BROWSER=/opt/firefox/firefox
and
# tail -2 /etc/.bash.shared
export BROWSER="/opt/firefox/firefox"
Now when I open terminal I get this:
$ env | grep BROWSER
BROWSER=/opt/firefox/firefox
2) Also I tested both Firefox and Chrome to see if the attach= worked in a mailto: URL, but so far I can't seem to this to work. I'm trying to browse to a URL something like these:
mailto:[email protected]?subject=xx&body=yy&attach=%22%2fhome%2fhoward%2fDesktop%2fphpmyadmin.pdf%22
(where the URL encoding is %22 is for a double quote (") and %2f is for a slash (/)).
I've also tried @attachment= rather than @attach=.
Both Thunderbird and Chrome open a new email window, and the subject and body work as expected, but the attachment is not present.
So first, I think I need to get @attach= to work with Firefox (or Chrome), but how?
I'm using:
Debian 9.9 (x86-64) (Linux Kernel 4.9.0-9-amd64)
Cinnamon 3.2.7 with
Google Earth 7.1.4.1529
Firefox Quantum 68.0.2 (64 bit) / Chrome 76.0.3809.100 (64-bit)
|
Here's a workaround to get a *.kmz file from Google Earth in GMU/Linux for your current location:
Create a push pin in the view you're at.
(The name doesn't matter, but if you name it your filename below will be that name.)
Then right click on this push pin and select 'Save Place As'.
Then you can attach this *.kmz file to an email to send it to someone.
(You can sometimes select File | Save, but this doesn't always work.)
| Google Earth: Unix email |
1,426,372,498,000 |
CRON has emailed me the extract below :
May 12 04:27:54 rpi postfix/smtpd[9343]: NOQUEUE: reject: RCPT from
unknown[95.211.213.214]: 504 5.5.2 <WIN-HBAL58UG0JH>: Helo command rejected: need
fully-qualified hostname; from=<[email protected]> to=<[email protected]>
proto=ESMTP helo=<WIN-HBAL58UG0JH>
May 12 04:27:54 rpi postfix/smtpd[9345]: NOQUEUE: reject: RCPT from
unknown[95.211.213.214]: 504 5.5.2 <WIN-HBAL58UG0JH>: Helo command rejected: need
fully-qualified hostname; from=<[email protected]> to=<[email protected]>
proto=ESMTP helo=<WIN-HBAL58UG0JH>
May 12 04:27:54 rpi postfix/smtpd[9343]: NOQUEUE: reject: RCPT from
unknown[95.211.213.214]: 504 5.5.2 <WIN-HBAL58UG0JH>: Helo command rejected: need
fully-qualified hostname; from=<[email protected]> to=<[email protected]>
proto=ESMTP helo=<WIN-HBAL58UG0JH>
It was split unto multiple lines, for every entry like above, it made viewing the email somewhat harder. Is it possible to prevent these newlines?
The CRON job is simply a command :
muhammad@rpi ~ $ cat /etc/cron.daily/mail-important-logs
#!/bin/sh
# filter out useful logs and email me
cat /var/log/mail.log | grep reject
|
dhag was on the right lines. It was squirrelmail wrapping the lines, when I exported the email it had no wrapping. Later I found a setting under options, which when I set really high took away the wrapping for my cron job logs.
But this has the side effect that now all your emails are not wrapped up to that limit, unless the sender has manual new lines inserted.
| how to prevent cron job email splitting into multiple lines |
1,428,913,881,000 |
I followed this guide to set up TLS and auth. I have a username (usr) and a password (pwd) set in /etc/exim4/passwd and the files has the right permissions:
-rw-r----- 1 root Debian-exim 51 Oct 16 13:11 passwd
If I remove the plain text part of the line in that file and run:
htpasswd -vb passwd usr pwd
then I get a nice
Password for user usr correct.
However, trying openssl s_client -connect $HOST:25 -starttls smtp and pasting:
ehlo test
250-example.org Hello example.org [1.2.3.4] ← Clearly, redacted…
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN
250-CHUNKING
250-PRDR
250 HELP
auth plain AHVzcgBwd2Q=
535 Incorrect authentication data
Where the base64 is taken from:
echo -ne '\0usr\0pwd' | base64
AHVzcgBwd2Q=
I have run systemctl restart exim4.service and update-exim4.conf a fair few times.
How to debug this?
|
The documentation lies so do not listen to it.
What you need is to uncomment the plain_server driver in conf.d/auth/30_exim4-config_examples and comment out the plain_saslauthd_server and login_saslauthd_server garbage. The saslauth driver do not work.
From there onwards, it will work as expected.
Source.
| Help in debugging Exim4 SMTP AUTH 535 Incorrect authentication data |
1,428,913,881,000 |
I have an Ubuntu 16.04 xenial Nginx server environment with postfix and a few webapps under /var/www/html.
How could I notify myself by my an email sent to my personal Gmail account, if my site is down?
The desired state is that if the webpages or at least in homepage, doesn't give https status 200 (OK), I'll get daily email, per each day the problem wasn't taken care off.
For example, each day I'll get:
Hello, your site domain.tld is down. Please fix it.
|
As mentioned in the comments, there are literally dozens of ways you can do this.
The most basic possible would be to call wget or curl from a daily cron job and check their exit code (if they can't download the page, they'll return a non-zero exit code), then use that to trigger an e-mail. While this approach has a few issues (for example, both wget and curl follow redirects, so it will also succeed for pretty much any 3xx code provided that it points to an accessible page).
A step up from that is a tool like monit, which has the added bonus that you can have it watch your web-server process and let you know if that stops running, and do all kinds of other useful checks (including allowing for mostly arbitrary scripted network service checks, checking network interface status, etc). This is probably the simplest option on most single servers.
If you've got a bunch of servers, you might look instead at something like nagios, which is designed for handling network-wide sanity checks.
Keep in mind also however that pretty much regardless of which option you go with, you're probably going to need to run a local mail server to forward messages to your gmail account (though this is really easy to do provided you're not using a hosting service that blocks outbound SMTP connections).
| Notifying myself thtat my webapp/website is down (Nginx environment) [closed] |
1,428,913,881,000 |
I'm currently planning my business servers and I would like to know what's the best Linux distro for these needs:
Nginx + MySQL + PHP 5.4
Zimbra Collaboration - Open Source
Node.js w/ Forever
I know it's a objective question but I asked a lot of people and they didn't answer me other thing than "It's your choice"...
I have a 2 CPU, 1GB RAM, 30GB SSD server...
|
You might want to use a distribution that has a low footprint. Debian quickly comes to mind, but I can't see why you wouldn't use ubuntu or centos or even gentoo or arch.
In the end of the day, you should use the distribution you feel more comfortable with.
| Best Linux for a small Web server [closed] |
1,428,913,881,000 |
How can I install GnuPG on my CentOS 7 system?
I want to use GnuPG alongside Thunderbird and Enigmail to manage pgp keys, as per the instructions in this link.
The problem is that the download instructions I find for linux all have to do with Debian. Here is an example.
EDIT
typing which gpg resulted in /usr/bin/gpg, however, it is not clear that this is the same aspect of GnuGPG that needs to be integrated with Thunderbird and Enigmail to manage gpg keys. Before this question can be considered answered, I need to know that GnuPG is installed in a way that can run with Thunderbird and Enigmail. Thus, the answer would give instructions for checking status, and instructions for downloading if it is not properly installed yet. I imagine this might only take several lines of actual methods.
|
install Enigmail
Thunderbird > Add-ons Menu > Enigmail
If you do not already have a PGP key, generate one:
gpg --gen-key
(follow its prompts to complete the process; default values are generally fine)
3. Restart Thunderbird. Enigmail will probably auto-detect the presence of your GnuPG keychain and use it. If it does not, point it to your GnuPG dir:
Thunderbird > Enigmail > Key Management
In the Key Management window, select
File > Import Keys from File
and show Enigmail to your /home/$USER/.gnupg directory. Import your key; ignore errors from Enigmail that it already knew about your key. You should now see your key listed in the Key Management window.
5. Email somebody!
| installing GnuGPG with Thunderbird on CentOS 7 |
1,428,913,881,000 |
I need to send an email. The requirements are as follows:
Plain text and not HTML (Message type)
Plain text and not base64 (Attachments, given that my attachments are all ASCII text files.)
How do I do this?
I use Debian 10 buster generic.
|
By default, command-line mail user agents send e-mail in plaintext. And there is no need to encode in Base64 an ASCII text file (encoding is done for binary content only).
So you can simply use this command:
mailx [email protected] < mytextfile.txt
| Sending email attachments in plain text format instead of base64 |
1,428,913,881,000 |
I am using linux (Debian 8) on my VPS server. I use virtualmin to handle all domains. I created emails using 'create new user' in the 'edit users' section. I can send emails to others, but I am not able to receive emails.
What could be the problem?
|
I solved the email issue by Configuring Postfix to not use ipv6. belos is way to do that.
add below line in your /etc/postfix/main.cf
inet_protocols = ipv4
and restart postfix using below command
systemctl restart postfix
i find above solution at below thread
https://www.virtualmin.com/node/53447
| I am not able to receive emails on my VPS [closed] |
1,428,913,881,000 |
I am switching to new system with a OS using Linux.I will be using another system which has windows ultimate which is hacked.I am being cyber bullied.
I have given a reference to this as a question on stackexchange.
Now I want to install some softwares on my system with linux that I havnt started it which can prevent from being hacked or being traced in any way.
A fear that I have is
-If I make a new email,it may be traced or hacked easily unless I contact old emails which I will not.
https://security.stackexchange.com/questions/18849/what-do-i-need-to-worry-about-when-moving-from-a-compromised-system-to-a-clean-o
|
Being 'traced' and being 'hacked' are two very different issues but I'll cover them in a broad sense.
If you need to surf anonymously you can use something like TOR to anonymize the traffic but that's not likely necessary.
Unless the person harassing you has recurring access to your old email addresses using them for recovery isn't a problem. If they do you should change the password and security questions. If your email host supports phone, text, or PIN security you should enable that. GMail is an example of an email host that provides this. If you can still log into your old email address you can kick them out of it if you make sure to change everything.
What likely happened to your windows installation wasn't the result of being hacked. You most likely opened a trojan or were infected with malware. Linux isn't impervious to these sorts of things but it's not as easily attacked. Make sure you stay up to date and only install software from trusted repositories.
| What software(s) should I install on new system(with Linux as a OS) to prevent it from getting hacked? [closed] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.