date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,418,997,015,000 |
I have two IP address running on Postfix and each IP has own domain. In short i want to isolate domain so outside folks think it is running on own IP and fully isolated even PTR also
But in postfix it not handling myhostname option IP specifically. it always use default value set in mail.cf file
I have tried to set -o myhostname=abc but it still using mail.cf value. Because of it my IP got block in SPAM list
How do i set IP specific myhostname so HELO banner looks good
Updated:
This is what going on:
I have two IP address on my Postfix mailserver I want to host two domain isolated with each other so no one can find out they are hosted on same server.
abc.com 1.1.1.1
zyx.com 2.2.2.2
Hostname of server is mail.abc.com so obvious postfix use it as myhostname
If i send email from zyx.com domain to [email protected] to check what helo my server sending then i am getting following reply, it is saying we mail system at host mail.abc.com ( thats why i want to use myhostname variable to set it base on which IP it is using to send email)
I am worry may be CBL blacklist my IP because Hostname is different and HELO FQDN is different.
This is the mail system at host mail.abc.com.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
The mail system
<[email protected]>: host helocheck.abuseat.org[54.245.112.115] said:
550 *** The HELO for IP address 2.2.2.2 was 'mail.zyx.com'
(valid syntax) *** (in reply to RCPT TO command)
|
-o myhostname=abc not much important. To affect HELO You must override -o smtp_helo_name=abc
Values configured in main.cf has complex inheritance, but it work only on main.cf loading. When You override some parameters latter, You need override all necessary.
For now, I dont know how to force postfix to send mail from domain over correct worker, But I think it possible.
UPD.
-o smtp_helo_name= enforce HELO FQDN. Additionaly You need define corresponding A (in Your domain zone) and PTR (in reverse zone of ISP or Datacenter or own if You have AS) records for Your server.
Example:
-o smtp_helo_name=mailserver.abc.com
Your Domain Zone abc.com
mailserver A 203.0.113.23
ISP Zone 113.0.203.in-addr.arpa
23 PTR mailserver.abc.com
It not necessary to match FQDN and mail domain it can be different. Primary, HELO FQDN resolvable to IP and IP resolvable to FQDN
$ host mailserver.abc.com
mailserver.abc.com has address 203.0.113.23
$ host 203.0.113.23
23.113.0.203.in-addr.arpa domain name pointer mailserver.abc.com
https://serverfault.com/questions/41693/best-practices-for-preventing-you-from-looking-like-a-spammer
| postfix multidomain myhostname configuration |
1,418,997,015,000 |
I have a problem with Mutt at the moment. I have a 4GL routine that creates some quite large output files and I want them to go in a single mail ideally. The total of these files is 21889119 (sum of zip files in Unix) and the message_size_limit in our Postfix config file is 25600000 so would expect these files to be sent. When I try to send them I get the following error :
postdrop: warning: uid=502: Illegal seek
sendmail: fatal: progress(502): queue file error')
which upon searching in Google comes back as a size error but to my mind I am almost 4M under the limit!
Does Mutt add a lot of padding to the attachments or are there other switches to zip or Mutt that I should apply?
|
The binary attachments need to be encoded as ascii and that typically expands them with 20-25%.
You will have that expansion problem with any mailer, commandline or not. You can easily test that by using thunderbird and sending the file through Google (or your provider).
| Mutt overheads or missing switches |
1,418,997,015,000 |
Thunderbird cannot search PGP-encrypted emails. Hence, I was considering copying all my emails from IMAP to local storage, then decrypting them all locally, so that they are searchable. Is this possible?
Thunderbird stores email folders as a single mbox file. I attempted gpg -d mbox_file, but this only decrypted a single email, and then failed with an error as follows.
gpg: [don't know]: invalid packet (ctb=46)
gpg: decryption failed: Bad signature
gpg: packet(3) too short
N.B. the mbox also contains non-encrypted email. I could perhaps filter these out from within Thunderbird, but the solution would preferably deal with this elegantly.
|
As of 2020 (sorry, I've no idea when this function was added) enigmail has a "decrypt to folder" option. (At the very bottom of the context menu.)
And you can select all messages in a folder, then use it to decrypt all messages in bulk.
(My search found your question as I'm wanting to do the opposite: take a directory of plain text messages and encrypt them all, such that enigmail is needed to read them.)
| How can I PGP decrypt an entire mbox? |
1,418,997,015,000 |
I operate a Linux system where I give out free Linux shell accounts to people for educational purposes. Unfortunately, while doing so it's expected to meet abusive users who will keep sending spam emails to other servers such as Google, Zoho, etc and hence will get the IP of the server blocked.
What I would like to do is allow the users on the system to send messages within localhost only. This means that when a user tries to send out an email to an external domain name, GMail for example, the request will be refused. However, if the user tries to send an email to another user on localhost (example: giovanni@localhost), the message will be sent. I don't mind receiving emails from other servers, but I don't want my server to send emails to other servers. How can I do so?
I'm running CentOS 6.5 with Postfix installed. How can I configure this? Any suggestion will be hugely appreciated!
|
Use a transport map:
Find or add the following line in your main.cf (alter the file location to fit your CentOS setup):
transport_maps = hash:/etc/postfix/transport
Edit the transport map file above to:
localhost :
<your FQDN> :
* error: Outgoing mail from this system has been disabled.
localhost and your FQDN will use local delivery. Anything else will be bounced with a message.
Update the database with:
# postmap /etc/postfix/transport
Reload the config:
# service postfix restart
| Allowing outgoing emails that will be delivered to localhost only |
1,418,997,015,000 |
Is there a way to horizontally center emails when reading them in a larger terminal using mutt? I'm not interested in centered justification of the text in the email, but I am interested in forcing the block of text to be left-aligned, 78 characters wide and centered in a 120 character terminal.
For example, right now I have something that looks roughly like this:
+------------------------------------------------------------------------------+
| This is an email displayed in mutt. |
| Let's say it's 78 characters wide, |
| even though it's clearly not. Let's |
| also pretend that the width of this |
| box is 120 characters, which is |
| also not true. |
+------------------------------------------------------------------------------+
Is there a way to configure mutt's pager so that it looks closer to something like this:
+------------------------------------------------------------------------------+
| This is roughly centered text that's |
| left-aligned and (let's pretend) also |
| 78 characters wide. I'm not worried |
| about perfection as much as I am just |
| getting the text closer to the middle |
| of the screen. |
+------------------------------------------------------------------------------+
I've searched the standard documentation, but I haven't found anything. Should I use something other than the default pager to get this effect?
|
Solutions within Mutt
I'm not finding much in the way of how to do this. Mutt has *_format variables, I suspect you could use those to control pager_format and index_format, for example:
set index_format="%4C %Z %[!%y-%m%d] %-18.18F (%4c) %s"
set pager_format="%S [%C] %n (%l) %s"
But I don't think this will give you what you want. Also I found a patched version of mutt here, titled: Mutt sidebar (folder list) patch, but again this creates a sidebar and doesn't appear to give you what you want.
So I think you might be out of luck, outside of modifying the source of mutt itself.
Using an external pager?
As an alternative perhaps you could utilize vim as a pager for Mutt instead. I found this post titled: Mark's Mutt Fan and Tip page.
excerpt
Integrates with my favorite text editor.
With Mutt's focus on mail, it doesn't include it's own message editor, but allows me to use one of my choosing. I consider this a feature. Using vim as my editor, I have Mutt configured to allow me to edit the full headers, opening the message with the cursor just below the subject line. For that I've added the following to my .muttrc file:
set edit_headers
set editor="vim +/^$ ++1"
Editing the full headers is nice because I don't to have to worry about how to add a standard or non-standard header to a message. I can edit them all with the ease I perform other text editing.
On the vim side, I have it configured to recognize the temporary files that Mutt creates as "mail" files, and highlight and format them accordingly. The relevant line in .vimrc file looks like this:
" set up syntax highlighting for my e-mail
au BufRead,BufNewFile .followup,.article,.letter,/tmp/pico*,nn.*,snd.*,/tmp/mutt* :set ft=mail
With an alternative pager configured you could set the foldcolumn in vim like so:
:set foldcolumn=<width>
NOTE: This is a bit of a hack, utilizing the fold column gutter space in this fashion but it works. You're limited to only 12 spaces max with this approach however.
If this doesn't work for you then take a look at a couple of other methods for performing alignment in vim in this SO Q&A titled: how to change the left margin in gvim.
References
6. Reference - Mutt documentation
| Center Mutt pager horizontally |
1,418,997,015,000 |
I have a very simple procmail process that takes an inbound email and redirects it to a script:
LOGFILE=/home/foo/procmail-log
VERBOSE=yes
MAILDIR=/var/spool/mail/foo
DEFAULT=/var/spool/mail/foo
SHELL=/bin/sh
:0
! `/home/foo/scripts/blah/blah.sh`
The shell script has a condition that greps a file for a sender's email address and if it finds it, it exits:
grep i "$SENDER" /home/foo/scripts/blah/blah2.txt
if [[ $? -eq 0 ]] ; then
exit 1
fi
When this happens, I want procmail to just give up / discard the message.
Interestingly enough though, if this triggers, procmail taking the value I just grepped and trying to send an email to it.
In the procmail log, I see:
procmail: Notified comsat: "foo@:/usr/sbin/sendmail -oi [email protected] [email protected]"
From [email protected] Thu Feb 6 22:31:47 2014
Subject: Test
Folder: /usr/sbin/sendmail -oi [email protected] sender 3165
procmail: Executing "/usr/sbin/sendmail,-oi,[email protected],[email protected]"
Why is it doing this? Is there any way I can configure procmail to not do this? I just want it to give up and drop the prior email it was processing. I've tried different exit codes (0, 1, 77) but procmail always does the same thing. Any ideas?
|
Procmail makes great efforts to assure that mail is not lost even if delivery fails. According to man procmail, email will be bounced back to sender as a last resort:
ORGMAIL Usually the system mailbox (ORiGinal MAIL‐
box). If, for some obscure reason (like
`filesystem full') the mail could not be
delivered, then this mailbox will be the
last resort. If procmail fails to save the
mail in here (deep, deep trouble :-), then
the mail will bounce back to the sender
There is, however, an environment variable that can be set to allow mail to be discarded rather than bounced:
DELIVERED If set to `yes' procmail will pretend (to
the mail agent) the mail has been deliv‐
ered. If mail cannot be delivered after
having met this assignment (set to `yes'),
the mail will be lost (i.e., it will not
bounce).
| Why does procmail send a copy of an inbound message to sender if it encounters an exit code? |
1,418,997,015,000 |
I have installed Postfix, I can send mails between local users as expected, but I would try to limit the access of a particular user to the server. I edited the /etc/postfix/access file in this way:
[email protected] REJECT
where example.com is $mydomain. I did also a postmap access to generate the validate file. Strangely, I can still send mail from the diego account using mutt. Here the maillog:
Jan 22 15:46:36 server postfix/pickup[6637]: 62117BF647: uid=500 from=<diego>
Jan 22 15:46:36 server postfix/cleanup[6737]: 62117BF647: message-id=<[email protected]>
Jan 22 15:46:36 server postfix/qmgr[6638]: 62117BF647: from=<[email protected]>, size=422, nrcpt=1 (queue active)
Jan 22 15:46:36 server postfix/local[6739]: 62117BF647: to=<[email protected]>, relay=local, delay=0.07, delays=0.06/0.02/0/0, dsn=2.0.0, status=sent (delivered to mailbox)
Jan 22 15:46:36 server postfix/qmgr[6638]: 62117BF647: removed
|
I found finally the correct sintax. If you want to just block a user, you have to edit the main.cf file in this way:
smtpd_sender_restrictions =
check_sender_access hash:/etc/postfix/access
and in the access file:
user@ REJECT
[email protected] REJECT #this will REJECT only if sender is from server.example.com domain
| Why access file is being ignored by Postfix? |
1,418,997,015,000 |
I get new-mail notifications when running bash interactively on Linux console but I don't get them on xterm or konsole.
The environment variable MAIL is set to /var/mail/USER upon logging in on the console but it's empty on xterm and konsole.
Also, MAIL is not mentioned in any of .bashrc, .profile, /etc/bash.bashrc, /etc/profile, /etc/profile.d/*, nor is it printed by grep -r MAIL= /etc.
Why is it unset in the graphical environment? (Debian 7.0)
|
The program login sets the MAIL environmental variable when you login to a Linux virtual console.
From the login(1) manpage:
The value for $HOME, $USER, $SHELL, $PATH, $LOGNAME, and $MAIL are set according to the appropriate fields in the password entry.
login is the program used to start a session when you login to a Linux virtual console. It prompts you for a username and password, sets some basic environmental variables, and starts a shell.
If you're using a graphical login manager (e.g. one supplied with Gnome or KDE) instead of login, the MAIL environmental variable may not be set.
Bash usually only gives mail notifications when it is being used as a login shell. Even if the MAIL environmental variable is set, a normal interactive instance of bash within xterm or konsole will not display a mail notification.
You can run bash with the -l flag to force it to behave like a login shell. You can pass xterm the -ls flag to make it start your shell as a login shell.
| Why is MAIL unset in graphical environments? |
1,418,997,015,000 |
How do I extract attachments from mails arriving at my postfix mailbox and preferably send the content of the attachment to another email account? I am interested in being able to acquire/read the content of the attachment on ubuntu terminal.
|
Install procmail if not already installed. In your postfix configuration ( /etc/postfix/main.cf ) make sure you have a line:
mailbox_command = procmail -a "$EXTENSION"
in your ~/.procmailrc insert the following (you will need a different matching pattern):
:0
* ^Subject:.*some_text_to_match
| /usr/local/bin/your_processing_program
In your_processing_program extract the attachments and forward them e.g. with a python or ruby program.
How to display the attachments in terminal depends on the attachment content. If it is text you could write it to the end of a file and use tail -f in the terminal.
| extracting attachments from mail that is coming to my postfix inbox |
1,418,997,015,000 |
I administer a home server, and sometimes when I'm out, I need to execute some simple commands on the server. 3G + SSH is not an option because it's too expensive from my phone (here in Argentina). It is easier to send an SMS to my mail account.
I want to fetch the mails I send to my server, and process the text surrounded by ** as bash commands.
What approach would you recommend?
|
I'd recommend you install procmail or some other mail processor. You can configure it so everything from you, with a subject line of a certain magical password that only you know will pass the contents to a script (which you could then execute).
But... you're opening a huge security hole so it's unwise to do this as it's an unencrypted form of remote access to your server.
| How to fetch and process mail in order to execute commands? |
1,418,997,015,000 |
I have recently started using mutt to access my email account via IMAP.
My IMAP connection settings are as follows:
set ssl_starttls = yes
set ssl_force_tls = yes
set imap_user = "[email protected]"
set smtp_url = "smtp://[email protected]@smtp.domain.tld:[port]/"
set folder = "imaps://imap.domain.tld:[port]"
set hostname = domain.tld
I have not stored my password so I have to type in my password every time I login
When I start mutt I see the following on the bottom line:
SSL/TLS connection using TLS1.2 (<some string of letters and numbers>)
When I type in my password on being prompted I see the following in the bottom line of my mutt window:
Authenticating (PLAIN)...
Does this mean that mutt is transmitting my password in plaintext?
Thank you for your help.
|
The authentication type PLAIN means there is no specific security protocol for the password itself on the IMAP protocol layer.
But the authentication still happens within the TLS1.2 connection, so unless TLS negotiation has accepted a NULL encryption, the whole connection, including the transmission of the password is protected by the TLS1.2.
To identify the actual strength of the TLS1.2 encryption, you would need to find the actual encryption algorithms and key lengths negotiated on the connection. The <some string of letters and numbers> part in the "SSL/TLS connection using TLS 1.2" message contains this information.
| IMAP authentication by Mutt: Is Mutt transmitting password in plaintext? |
1,418,997,015,000 |
When using mutt command:
mutt -e "set content_type=text/plain" -e "my_hdr From:[email protected]" -s "取样更多 サンプル 样品 text" -c "取样更多" -a "サンプル取样更多"
Now this mail will not be sent obviously, but the point is when I see the mail using sudo postsuper -q ID, subject of the mail is garbled, i.e.:
*** ENVELOPE RECORDS deferred/8/874FF381CDB ***
message_size: 682 346 2 0 682 3
message_arrival_time: Mon Sep 14 19:44:38 2020
create_time: Mon Sep 14 19:44:38 2020
named_attribute: rewrite_context=local
sender_fullname: My_name
sender: my_name@my-pc
named_attribute: dsn_orig_rcpt=rfc822;[email protected]
original_recipient: [email protected]
recipient: [email protected]
named_attribute: dsn_orig_rcpt=utf-8;取样更多@my-pc
original_recipient: 取样更多@my-pc
done_recipient: 取样更多@my-pc
*** MESSAGE CONTENTS deferred/8/874FF381CDB ***
Received: by my-pc (Postfix, from userid 1000)
id 094FF381CDB; Mon, 14 Sep 2020 19:44:38 +0530 (IST)
Date: Mon, 14 Sep 2020 19:44:38 +0530
From: My_name <[email protected]>
To: [email protected]
Cc: 取样更多@my-pc
Subject: =?utf-8?B?5Y+W5qC35pu05aSaIOOCteODs+ODlw==?=
=?utf-8?B?44OrIOagt+WTgQ==?= text
Message-ID: <20200914141438.GA4858@my-pc>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename*=utf-8''%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E5%8F%96%E6%A0%B7%E6%9B%B4%E5%A4%9A
Content-Transfer-Encoding: 8bit
User-Agent: Mutt/1.10.1 (2018-07-13)
サンプル body of the attached file in chinese 取样更多
*** HEADER EXTRACTED deferred/8/874FF381CDB ***
named_attribute: encoding=8bit
*** MESSAGE FILE END deferred/8/874FF381CDB ***
Now contents of ~/.muttrc is:
set config_charset=utf-8
set signature="iconv -f utf-8 ~/.signature |"
set charset="utf-8"
set send_charset="utf-8"
set rfc2047_parameters="yes"
set assumed_charset="utf-8"
Some important locale env variables are:
LANG=en_IN.utf8
LANGUAGE=
LC_CTYPE=en_IN.utf8
LC_NUMERIC=en_IN
LC_TIME=en_IN
LC_COLLATE="en_IN.utf8"
LC_MONETARY=en_IN
LC_MESSAGES=en_IN.utf8
LC_PAPER=en_IN
LC_NAME=en_IN
LC_ADDRESS=en_IN
LC_TELEPHONE=en_IN
LC_MEASUREMENT=en_IN
LC_IDENTIFICATION=en_IN
LC_ALL=
mutt -v is Mutt 1.10.1 (2018-07-13)
One important thing, my mails are saved in a file /var/mail/my_name, so If I cat this file using vim, or editor I still get same thing, but when I open this file using evolution, it shows everything correct.
|
The subject is not garbled. It's encoded in the MIME encoded-word format. There isn't a single standard encoding for email. The Content-Type header indicates the encoding of the body, but it doesn't apply to headers such as Subject. If a header contains non-ASCII characters, they need to be encoded in a format that indicates the encoding. That's where encoded-word comes into play.
=?utf-8?B?…?= is a word whose UTF-8 bytes are encoded in Base64. 5Y+W5qC35pu05aSaIOOCteODs+ODlw== is the Base64 representation of the bytes that represent 取样更多 in UTF-8.
$ echo '=?utf-8?B?5Y+W5qC35pu05aSaIOOCteODs+ODlw==?=
=?utf-8?B?44OrIOagt+WTgQ==?= text' |
python3 -c '
import sys;
from email.header import decode_header;
print("".join(text.decode(encoding or "ascii") for text, encoding in decode_header(sys.stdin.read())))
'
取样更多 サンプル 样品 text
| Mutt subject is garbled when using japanese/chinese characters |
1,418,997,015,000 |
All I can find online refers to a setup where you own the mailserver. This is not the case here.
I have a headless (so thunderbird is a no go) machine (ARM) on which I need to setup an automated mail reply client. The mail service I am using does not have such a feature. I can access my mails using the IMAP protocol, and send mails using the SMTP protocol.
reply-o-matic seems similar to what I want, but unless I get it wrong it only works when the mailserver is installed on the machine.
I've also found vacation but again, all the setup tutorials I come across mention a setup with "postfix", which is a mailserver, so not the kind of setup I need.
Can someone point me to a CLI mail client that supports such feature?
|
I have now solved this the easy (yet a bit resource intensive) way, using VNC and thunderbird.
Here's a step by step guide which was performed on a headless debian machine:
1. Install a graphical environment
I wanted the absolute most lightweight system there is. xfce4 shocked me with its many dependencies (total disk space would've been 474MB for me with 266 new packages). lxde came in even worse at 579MB at 384 packages.
I decided to go with icewm - Which technically isn't a full desktop environment but a standalone window manager. 268MB at 117 packages.
sudo apt-get install icewm
2. Install the VNC server
tightvnc is a very lightweight, fast, easy to setup VNC server that automatically creates a virtual desktop, so perfect to run on a headless machine.
sudo apt-get install tightvncserver
3. Create a new user for the VNC server
This is optional, but I wanted to keep things as tidy as possible.
sudo adduser vnc
Enter a desired password, you can keep the other questions blank.
4. Start the VNC server
First, log into the new account, then start the VNC server.
su - vnc
vncserver
As simple as that! It will ask you for a password you need to login.
To connect to your VNC server you can use any VNC viewer you like, there's even plenty on your smartphone's appstore. I went with vinagre on my desktop. You simply connect to it by using the servers IP and the default port 5901.
5. Install thunderbird and set-up auto-reply
sudo apt-get install thunderbird
This is a bit heavy on resources (26 packages for me, 184MB) but it makes the setup of automatically replying to mails a very easy task.
Open thunderbird within the VNC desktop, choose to use your existing email and log into your email account using IMAP.
Next we need to create a templete for our out-of-office reply. Hit the Write button on the top, and write your message and subject as you'd like. Once done, go to File -> Save As -> Template. The template name will be your subject.
Now hit the menu button and go to Message Filters -> Message Filters. Inside that window, click on New on the right. Here you can give your filter a name (e.g. Out of office). You can keep the Apply filter when settings at default, or change it to Filter after Junk Classification if you'd like.
Here you can further set specific filters you would like, for example to black- or whitelist specific senders or subjects. If you don't want any filter, select Match all messages.
On the bottom actions now select Reply with Template and select your template. That's it! Optionally you can add another action to mark the message as read aswell, but I won't do that so I know what I have to manually check/reply to later. You could also have the message tagged so you will easily know later which messages an auto-replied has been given to, if you used filters above.
Simply hit OK now. Using the Enabled checkbox you can turn it on or off.
You're done!
Don't forget to simply disconnect the VNC session, leaving thunderbird open, as logging out would terminate thunderbird. Consider the use of filters to avoid spam or similar if you need to.
| CLI E-Mail client with auto reply? |
1,418,997,015,000 |
Fail2ban is doing it's job and fail2ban-client status is showing me they're all working fine and offending addresses get blocked.
When an address is blocked I like to receive a mail. That's working for all jails except for one. Why?
Here are the relevant parts of /etc/fail2ban/jail.local:
# My own domain is here, not example.com, obviously.
sender = [email protected]
banaction = iptables-multiport
mta = sendmail
action_mwl = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
%(mta)s-whois-lines[name=%(__name__)s, dest="%(destemail)s", logpath=%(logpath)s, chain="%(chain)s", sendername="%(sendername)s"]
action = %(action_mwl)s
# This one is working. Others are as well.
[postfix]
enabled = true
port = smtp,ssmtp,submission
filter = postfix
logpath = /var/log/mail.log
# This one is not working.
[recidive]
enabled = true
filter = recidive
logpath = /var/log/fail2ban.log
bantime = 604800 ; 1 week
findtime = 86400 ; 1 day
maxretry = 5
Here is the output of fail2ban-client status recidive (a bit anonymized):
Status for the jail: recidive
|- filter
| |- File list: /var/log/fail2ban.log
| |- Currently failed: 34
| `- Total failed: 270
`- action
|- Currently banned: 9
| `- IP list: 195.154.237.*** 91.200.12.*** 195.154.255.***
`- Total banned: 12
Postfix:
Status for the jail: postfix
|- filter
| |- File list: /var/log/mail.log
| |- Currently failed: 0
| `- Total failed: 1058
`- action
|- Currently banned: 0
| `- IP list:
`- Total banned: 162
postfix.conf:
[INCLUDES]
before = common.conf
[Definition]
_daemon = postfix/smtpd
failregex = ^%(__prefix_line)sNOQUEUE: reject: RCPT from \S+\[<HOST>\]: 554 5\.7\.1 .*$
^%(__prefix_line)sNOQUEUE: reject: RCPT from \S+\[<HOST>\]: 450 4\.7\.1 : Helo command rejected: Host not found; from=<> to=<> proto=ESMTP helo= *$
^%(__prefix_line)sNOQUEUE: reject: VRFY from \S+\[<HOST>\]: 550 5\.1\.1 .*$
^%(__prefix_line)simproper command pipelining after \S+ from [^[]*\[<HOST>\]:?$
^%(__prefix_line)sNOQUEUE: reject: RCPT from (.*)\[<HOST>\]: 454 4\.7\.1\.*
ignoreregex =
recidive.conf:
[INCLUDES]
before = common.conf
[Definition]
_daemon = fail2ban\.actions
_jailname = recidive
failregex = ^(%(__prefix_line)s|,\d{3} fail2ban.actions%(__pid_re)s?:\s+)WARNING\s+\[(?!%(_jailname)s\])(?:.*)\]\s+Ban\s+<HOST>\s*$
From /var/log/fail2ban.log:
2016-12-15 08:01:52,620 fail2ban.actions[18430]: WARNING [wordpress-soft] Unban 160.202.163.***
2016-12-15 08:01:59,649 fail2ban.actions[18430]: WARNING [wordpress-soft] Ban 160.202.163.***
2016-12-15 08:02:00,610 fail2ban.actions[18430]: WARNING [recidive] Ban 160.202.163.***
2016-12-15 08:12:00,587 fail2ban.actions[18430]: WARNING [wordpress-soft] Unban 160.202.163.***
So I am positive Fail2ban's mail function is working. And all jails are working. There seems to be no difference between recidive and the other jails. What am I missing?
|
I had the same problem. I have 2 jails going, the ssh and recidive. The ssh jail was sending me emails perfectly, but nothing from recidive. I am running:
Fail2Ban v0.8.13
My relevant global config is identical to what you posted:
banaction = iptables-multiport
mta = sendmail
action_mwl = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
%(mta)s-whois-lines[name=%(__name__)s, dest="%(destemail)s", logpath=%(logpath)s, chain="%(chain)s", sendername="%(sendername)s"]
action = %(action_mwl)s
My initial recidive jail config (which was not sending emails):
[recidive]
enabled = true
filter = recidive
logpath = /var/log/fail2ban.log
#action = iptables-allports[name=recidive]
# sendmail-whois-lines[name=recidive, logpath=/var/log/fail2ban.log]
bantime = 604800 ; 1 week
findtime = 604800
#findtime = 86400 ; 1 day
maxretry = 3
Note that I had commented out the default recidive action. At least for me, that was what came as the default. I did this because I wanted the recidive emails to work like the ssh, which also used the default action. With this config... I got nothing. Crickets. But the recidive jail did work. I don't know exactly what the issue was, but I knew I had to fix it. So, I first tried uncommenting the action. Then, it still worked, but no emails. Or, so I thought. Turned out the emails were going to the local root account. I found them in the /var/mail/[user] mailbox, which I had root mail forwarded to. So, then I realized that was because destemail was not being used in this default action. So, what I ended up doing was just copying the global default action_mwl & tweaked it to take the port out.
So my final recidive jail config, which worked:
enabled = true
filter = recidive
logpath = /var/log/fail2ban.log
#action = iptables-allports[name=recidive]
# sendmail-whois-lines[name=recidive, logpath=/var/log/fail2ban.log]
action = %(banaction)s[name=%(__name__)s, protocol="%(protocol)s", chain="%(chain)s"]
%(mta)s-whois-lines[name=%(__name__)s, dest="%(destemail)s", logpath=%(logpath)s, chain="%(chain)s", sendername="%(sendername)s"]
Perhaps this is all by design or an old bug - I don't know. But this is how I got it to work. This may be too late to help you, but maybe it will help the next one in the same boat...
| Why does Fail2ban not send mail for one particular jail? |
1,418,997,015,000 |
I am trying to familiarize myself with crontab. I know that it is supposed to send an email containing the output of jobs to the user that scheduled them however, I can see in the syslog that the address crontab is sending emails to is not a "local" one (as if I were to type mail -s "email here" username) but an external email address (like [email protected]).
Can someone tell me from where this email is derived and how I can set the users' email address to something else?
This could be because I have a top-level domain associated with my instance (I can see in the log the emails are being sent there), however, I actually have two domain names pointed to this server so I don't know how crontab is choosing or what would happen if there were no domain on this machine.
In short I am just trying to figure out where this default email address is set.
|
man 5 crontab
If MAILTO is defined (and non-empty), mail is sent
to the user so named. MAILTO may also be used to direct mail to multi‐
ple recipients by separating recipient users with a comma.
| Where does crontab get the email address of the user it emails / where are user email addresses set? |
1,418,997,015,000 |
Can mutt send mail from command line without command line parameters, with subject, cc, bcc, reply-to, in-reply-to all defined inside mail.txt file with body of the message too (the same file format like mutt opens to me when i press m-send mail, or r-reply to mail).
... So that I can:
press 'r' on received mail, prepare my reply message, save it with ':w ~/preparedmail.txt' in vim ... cancel sending
and than run $ at 8:00 <<< "mutt < ~/preparedmail.txt"
... or is there other tool that will accept this file format. Or other way to achieve this.
|
If you are using sendmail or postfix to deliver the mail, you can use
sendmail -t <~/preparedmail.tx
and it will extract the destination recipient(s) from any To: Cc: or Bcc: header lines in the file (upto the first blank line) and send the file as mail.
For people having configured a tool like mutt to send mail directly,
an easy solution is to use msmtp, a program to send a prebuilt mail which also takes -t like sendmail to get the recipients, and is much easier to configure for smtp with credentials than postfix or sendmail. Here is an example ~/.msmtprc to send mail to gmail:
account gmail
host smtp.gmail.com
port 587
tls on
# from [email protected]
auto_from on
auth on
user [email protected]
# password mypassword
passwordeval gpg -d ~/.msmtp.password.gpg
account default : gmail
Don't forget to chmod og= ~/.msmtprc.
| mutt send mail from command line, with headers inside text file |
1,425,123,351,000 |
I run a debian 7 system and I run postfix as smtp server. I can send mail from postfix to outside (even though it gets to spam folders by google) but when I try to send a mail from, lets say my google account to my server I get error.
Lets say my ip is 77.77.77.77, my hostname machine.host.org and the dns: example.ru
I get this error from google:
Delivery to the following recipient failed permanently:
[email protected]
Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the server for the recipient domain example.ru by machine.host.org. [77.77.77.77].
The error that the other server returned was:
554 5.7.1 <[email protected]>: Relay access denied
My main.cf is:
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# SSL/TLS certificates
smtpd_tls_cert_file=/etc/ssl/certs/mailcert.pem
smtpd_tls_key_file=/etc/ssl/private/mail.key
smtpd_use_tls = yes
smtpd_tls_auth_only = yes
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
# Hostname and domain name
myhostname = machine.host.org
mydomain = host.org
myorigin = /etc/mailname
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname localhost.$mydomain $mydomain
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 example.ru
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
# Anti-SPAM rules adapted from https://wiki.debian.org/Postfix
smtpd_recipient_restrictions = permit_sasl_authenticated,
permit_mynetworks,
check_policy_service unix:private/policy-spf,
reject_invalid_hostname,
reject_unknown_recipient_domain,
reject_unauth_destination,
reject_rbl_client sbl.spamhaus.org,
permit
smtpd_helo_restrictions = reject_invalid_helo_hostname,
reject_non_fqdn_helo_hostname,
reject_unknown_helo_hostname
smtpd_client_restrictions = reject_rbl_client dnsbl.sorbs.net
# Mail will be stored in users ~/Maildir directories
home_mailbox = Maildir/
mailbox_command =
# From http://wiki2.dovecot.org/HowTo/PostfixAndDovecotSASL
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
# This changed the ups the policy time limit so the policy server won't time out while a message is still being processed.
policy-spf_time_limit = 3600s
# for OpenDKIM from https://tipstricks.itmatrix.eu/installing-opendkim-in-debian-squeeze/
milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:localhost:12345
My master.cf is:
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - - - - smtpd
#smtp inet n - - - 1 postscreen
#smtpd pass - - - - - smtpd
#dnsblog unix - - - - 0 dnsblog
#tlsproxy unix - - - - 0 tlsproxy
submission inet n - - - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
smtps inet n - - - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
#628 inet n - - - - qmqpd
pickup fifo n - - 60 1 pickup
cleanup unix n - - - 0 cleanup
qmgr fifo n - n 300 1 qmgr
#qmgr fifo n - n 300 1 oqmgr
tlsmgr unix - - - 1000? 1 tlsmgr
rewrite unix - - - - - trivial-rewrite
bounce unix - - - - 0 bounce
defer unix - - - - 0 bounce
trace unix - - - - 0 bounce
verify unix - - - - 1 verify
flush unix n - - 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - - - - smtp
relay unix - - - - - smtp
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - - - - showq
error unix - - - - - error
retry unix - - - - - error
discard unix - - - - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - - - - lmtp
anvil unix - - - - 1 anvil
scache unix - - - - 1 scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
# lmtp cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
# mailbox_transport = lmtp:inet:localhost
# virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus unix - n n - - pipe
# user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp unix - n n - - pipe
flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
${nexthop} ${user}
dovecot unix - n n - - pipe
flags=DRhu user=email:email argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}
policy-spf unix - n n - - spawn
user=nobody argv=/usr/bin/policyd-spf
And the log from /var/log/mail.log is:
Jan 6 16:20:41 vps127955 postfix/smtpd[16499]: connect from mail-we0-f170.google.com[1.1.1.1]
Jan 6 16:20:43 vps127955 policyd-spf[16501]: None; identity=helo; client-ip=1.1.1.1; helo=mail-we0-f170.google.com; [email protected]; [email protected]
Jan 6 16:20:43 vps127955 policyd-spf[16501]: Pass; identity=mailfrom; client-ip=1.1.1.1; helo=mail-we0-f170.google.com; [email protected]; [email protected]
Jan 6 16:20:43 vps127955 postfix/smtpd[16499]: NOQUEUE: reject: RCPT from mail-we0-f170.google.com[1.1.1.1]: 554 5.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-we0-f170.google.com>
Jan 6 16:20:43 vps127955 postfix/smtpd[16499]: disconnect from mail-we0-f170.google.com[1.1.1.1]
How can I solve this problem?
EDIT 1:
When I try to send from [email protected] to [email protected] the mail is not delivered and I get this:
Jan 6 17:09:22 vps127955 postfix/smtpd[16675]: A00BF2C00CBE: client=localhost[::1]
Jan 6 17:09:27 vps127955 postfix/cleanup[16685]: A00BF2C00CBE: message-id=<[email protected]>
Jan 6 17:09:27 vps127955 postfix/qmgr[16476]: A00BF2C00CBE: from=<[email protected]>, size=354, nrcpt=1 (queue active)
Jan 6 17:09:27 vps127955 postfix/smtp[16686]: A00BF2C00CBE: to=<[email protected]>, relay=none, delay=13, delays=13/0.03/0.02/0, dsn=5.4.6, status=bounced (mail for example.ru loops back to myself)
Jan 6 17:09:27 vps127955 postfix/cleanup[16685]: E5DB12C00CC1: message-id=<[email protected]>
Jan 6 17:09:27 vps127955 postfix/qmgr[16476]: E5DB12C00CC1: from=<>, size=2549, nrcpt=1 (queue active)
Jan 6 17:09:27 vps127955 postfix/bounce[16687]: A00BF2C00CBE: sender non-delivery notification: E5DB12C00CC1
Jan 6 17:09:27 vps127955 postfix/qmgr[16476]: A00BF2C00CBE: removed
Jan 6 17:09:27 vps127955 postfix/smtp[16686]: E5DB12C00CC1: to=<[email protected]>, relay=none, delay=0.01, delays=0.01/0/0/0, dsn=5.4.6, status=bounced (mail for example.ru loops back to myself)
Jan 6 17:09:27 vps127955 postfix/qmgr[16476]: E5DB12C00CC1: removed
but when I try to send from [email protected] to [email protected] the mail is delivered and I get this
Jan 6 17:10:52 vps127955 postfix/smtpd[16675]: 1E2762C00CBE: client=localhost[::1]
Jan 6 17:10:57 vps127955 postfix/cleanup[16685]: 1E2762C00CBE: message-id=<[email protected]>
Jan 6 17:10:57 vps127955 opendkim[14116]: 1E2762C00CBE: no signing table match for '[email protected]'
Jan 6 17:10:57 vps127955 opendkim[14116]: 1E2762C00CBE: no signature data
Jan 6 17:10:57 vps127955 postfix/qmgr[16476]: 1E2762C00CBE: from=<[email protected]>, size=368, nrcpt=1 (queue active)
Jan 6 17:10:58 vps127955 postfix/local[16690]: 1E2762C00CBE: to=<[email protected]>, relay=local, delay=17, delays=16/0.14/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)
Jan 6 17:10:58 vps127955 postfix/qmgr[16476]: 1E2762C00CBE: removed
|
In main.cf I changed the line
mydestination = $myhostname localhost.$mydomain $mydomain
into the line
mydestination = $myhostname localhost.$mydomain $mydomain example.ru
Now everything seem to work fine. However, if someone knows what the actual cause of the problem is, please enlighten us!
| Relay access error when I try to send mail from outside to postfix |
1,425,123,351,000 |
I have some (~3) Debian boxes, and I want to post system mail to my non-local mailbox. But I have a problem with configuring exim4. Also I don't like so much exim4's config. Too different, and also with my last try I had to store the password unencrypted.
I have 2 questions:
How do I configure outgoing mail with GMail/GApps SMTP? (password stored encypted)
How to return all of MY and ROOT's mails to my other address, sent trough the new SMTP?
Any question, or info needed, just comment. I would really appreciate any tutorial!
Thanks!
|
Do you need to use exim4?
I recommend using postfix. This guide helps you do this with encrypted password
http://www.marksanborn.net/linux/send-mail-postfix-through-gmails-smtp-on-a-ubuntu-lts-server/
| How to send non-local mail, with GMail(GApps) SMTP? |
1,425,123,351,000 |
I'm running Fedora 13 Linux, and sending mail to myself using mutt, and I can't seem to get procmail to run. Below is what my .procmailrc, ~/Procmail/rc.testing, and .forward files all look like. As you can see, they are very simple.
.procmailrc
HOME=/home/cory
SHELL=/bin/bash
PMDIR=$HOME/Procmail
LOGFILE=$PMDIR/pmlog
LOG="
"
LOG="My PATH is currently $PATH
My SHELL is currently $SHELL
"
VERBOSE=yes
MAILDIR=$HOME/Mail
INCLUDERC=$PMDIR/rc.testing
rc.testing
:0:
* ^Subject:.*test
IN-testing
.forward
#.forward
"|/usr/bin/procmail"
The Fedora Project documentation says that the existence of .procmailrc should "invoke Procmail whenever an MTA receives a new message." As I understand it, when I send myself a message using mutt, .procmailrc will be read by procmail and the logfile pmlog should be created in my Procmail directory.
However, this log file never gets created, so it appears that procmail is never being run!
The documentation also states "Fedora 13 provides two MTAs: Sendmail and Postfix. If both are installed, postfix is the default MTA." Since which postfix results with nothing on my machine, I assume sendmail is being used. Why doesn't sendmail invoke procmail?
|
The postfix command exists in /usr/sbin/ if Postfix is installed, and regular users do not have the /sbin/ directories in their PATH variable by default. The best way to check is by asking your package manager - in this case, by typing rpm -q postfix.
If it is installed, check the value of the mailbox_command parameter, either by looking for it in /etc/postfix/main.cf or by typing /usr/sbin/postconf mailbix_command. If that returns something other than `procmail -a "$EXTENSION" then Postfix isn't invoking procmail on local deliveries, which would be the problem.
You also should check if procmail is actually installed (binary should be in /usr/bin/procmail or you can check by rpm -ql procmail if my memory about rpm-based package management serves).
If it turns out you are using sendmail, then please for the love of all that's good and sacred, install postfix instead. Please don't make me try to remember how to edit and modify sendmail rules files...
| Why is procmail not being run? |
1,425,123,351,000 |
Does anybody on this planet know what the equivalent GNU mailutils command to the following looks like?
Is this even possible without a local MTA with mailutils?
Using s-nail it works as intended.
s-nail -s "$subject" -S $smtp_server -r $from_user $to <<<$message
according to the GNU mailutils manual
I tried:
mail --subject "$subject" \
--set smtp=$smtp_server \
--exec "set sendmail=smtp://$smtp_server" \
--append "From:$from_user" \
$to <<<$message
mail: Cannot open mailer: Input/output error
mail: cannot send message: Input/output error
this is not a duplicate of can-i-set-up-system-mail-to-use-an-external-smtp-server as they used a local MTA or heirloom-mailx or s-nail or other tools. I am using Debian.
|
got it.
on default mailutils mailer url (smtp://$smtp_server) uses startls.
Found it using verbose mode:
mail --subject "$subject" \
--exec "set sendmail=smtp://$smtp_server" \
--exec 'set verbose' \
--append "From:$from_user" \
$to <<<$message
mail: S: 220 xxx ESMTP
mail: C: EHLO xxx
mail: S: 250-xxx
mail: S: 250-PIPELINING
mail: S: 250-SIZE 10240000
mail: S: 250-ETRN
mail: S: 250-STARTTLS
mail: S: 250-AUTH PLAIN LOGIN
mail: S: 250-ENHANCEDSTATUSCODES
mail: S: 250-8BITMIME
mail: S: 250-DSN
mail: S: 250 CHUNKING
mail: C: STARTTLS
mail: S: 220 2.0.0 Ready to start TLS
mail: C: EHLO xxx
mail: Cannot open mailer: Input/output error
mail: cannot send message: Input/output error
giving mailer url the notls parameter solves it:
mail --subject "$subject" \
--exec "set sendmail=smtp://$smtp_server;notls" \
--exec 'set verbose' \
--append "From:$from_user" \
$to <<<$message
| How can I make GNU mailutils to use an external SMTP server? |
1,425,123,351,000 |
I run Courier IMAP with STARTTLS support. Currently, IMAP_TLS_REQUIRED is set to 0 (false), meaning that a client is fully permitted to use a clear-text login on an unsecured channel. Setting it to 1 (true) is not an option, as it breaks SquirrelMail (which can't use STARTTLS); however, I know for a fact that only certain IP addresses are legitimately going to be using unencrypted transport.
In the simplest case, it should theoretically be possible to permit connections from 127.0.0.1 without encryption, while demanding STARTTLS before auth on all other connections. However, I've been unable to do this. Also, what if I want something more complicated - maybe there's a web server on 203.0.113.147 talking to an IMAP server on 203.0.113.148, with a secure LAN in between. (Ignore for now the challenge of proving that the LAN truly is secure.) Is there a way to set IMAP_TLS_REQUIRED differently for different connections?
|
I don't think there would be a way to set IMAP_TLS_REQUIRED to true and use clients that don't support STARTTLS.
However, you have other possibilities if you full control of the network. For the SquirrelMail connections, you could use one firewall rule per IP address so at least only those people can connect to that service without TLS. It won't really make it any safer if MiTM is still a possibility on the network.
However, that doesn't force the other users (say, Thunderbird users) to use encryption. So it's not as safe as could be.
The one other way is to run two instances of courier on two different ports. You could choose a different port for the non-secure (it won't really hide it from hackers who can always check all your open ports). That way the one version with encryption can use the IMAP_TLS_REQUIRED flag and at least those users will never end up not using encryption.
All of that said, it looks like TLS v1.2 is not working (at least on Ubuntu 18.04) so courier may have to be changed to something else...
| Courier IMAP, TLS, and trusted IPs |
1,425,123,351,000 |
I have following macro defined in my muttrc:
macro index s ":set confirmappend=no delete=yes auto_tag=yes\n\
<save-message>=archive\n<sync-mailbox>:set delete=ask-yes\n"
When I press s on a message, it will immediately be moved into my archive folder.
I would like to modify my macro, so that I will be asked for confirmation before the message is moved.
But when I change confirmappend=yes:
macro index s ":set confirmappend=yes delete=yes auto_tag=yes\n\
<save-message>=archive\n<sync-mailbox>:set delete=ask-yes\n"
and when I press s, mutt becomes immediately unresponsive, all keys stop working, I cannot even exit. The cpu runs at 100% and I have to log in from another console to kill mutt.
Can somebody please advise how to correctly modify my macro?
|
Remove the \n from after the folder name so the command you are looking for is
macro index s ":set confirmappend=no delete=yes auto_tag=yes\n\
<save-message>=archive<sync-mailbox>:set delete=ask-yes\n"
| mutt: ask for confirmation before moving message to archive |
1,425,123,351,000 |
Basically, what I did:
Copied vmail folder to my local machine.
Reinstalled my VPS.
Installed iRedMail again.
Created same users on the same domain.
Question is - can I somehow copy over my old vmail folder in new one to import the old emails ?
Ubuntu 12.04, iRedMail 0.8.5 on postgresql. Previous installation was on MySQL, I have full database backup.
I do not know what info to give more, surely ask for any other.
|
After consulting with iRedMail developers, copying over old vmail to new worked.
| Is it possible to import vmail folder from old iRedMail to new iRedMail installation? |
1,425,123,351,000 |
While setting up a new Postfix installation on a Mageia 3 Linux system, I came upon a few entries in the default /etc/postfix/aliases file that I do not know the background of:
# Common aliases for system accounts.
...
foo: root
falken: root
# traps to catch security attacks
...
moof: root
moog: root
None of these aliases exists in the aliases file included in the Postfix source code distribution and I was unable to find any concrete reference to justify their existence.
Does anyone know why these aliases may have been included? Is there perhaps some interesting historical background?
Considering that I do not intend to have people send mail to root through any of these aliases, do they actually offer any sort of functionality in some other scenario? Or are they just noise to be removed?
|
falken is most likely a reference to the incredibly crappy 1983 movie War Games. I'll probably get voted down for saying that because a lot of people like that movie, but it was just dumb. Worse, it set the standard for how hacker movies were supposed to look. OTOH I couldn't stand the movie back then...but i'd probably be amused by it today.
moof is probably a reference to the Apple dogcow, which was a popular in-joke in Mac programming circles in the mid-1980s. I recall references to the dogcow in Apple Tech Notes of that era, and maybe also in the Macintosh Programmer's Workshop (MPW) documentation.
It's hard to be believe it now, but once upon a time, Apple used to be a company full of hackers and geeks.
I don't know about moog - maybe someone at Mageia likes early analog synthesizers?
The aliases can almost certainly be deleted or commented out without causing any problems. They're probably just a joke.
| Unknown entries in the default /etc/postfix/aliases file |
1,425,123,351,000 |
I'm playing around with various bits of an email solution, including notmuch and alot. I write my emails in vim and I'd like to have tab completion of email addresses while writing email. Is there a general plugin that would do something like this for me?
Ideally it would have a variable for what command to run and write and accept one of the standard address book formats - say mutt's format.
Plugins I've found so far:
email.vim - basic and based on a single text file, but probably the easiest to hack if I can't find anything better
lbdbq and lbdbQuery.vim which both use lbdb
The addressbook I'm currently using is nottoomuch-addresses
|
You can write your own custom insert-mode completion, and :imap that for easy access. There's an example in the help at :help E840 that shows the boilerplate; you just need to implement the email address query, probably either with system() or readfile().
| Autocompletion of email addresses in vim |
1,425,123,351,000 |
I'm using neomutt (an updated fork of mutt) as my CLI MUA (read: mail reading software in the terminal) and have all my messages synced offline using isync/mbsync and stored in the maildir-format on my Debian Stable system.
Sometimes I want to reply to a message and attach another email (e.g. as a reference). This can be easily done when using the maildir-storage format since all messages are separate files; I just need to attach the file in my local folder. The problem is that I have difficulties finding the email files.
Obviously I can search through all of my messages (e.g. by using mu, which is my mail indexer) and then attach it, but this is tedious. It would be a lot easier to just display the path and filename somewhere when I read an email, optimally in my pager within neomutt.
But despite looking for a solution, I wasn't able to find that. Any ideas or workarounds?
|
I just stumbled onto a solution: before sending the email, instead of pressing a to attach a file you can use A to select a mail folder, then using t to tag one (or multiple) messages and then attach the selected messages using Return.
| Display name and/or path of currently viewed email in mutt/neomutt |
1,425,123,351,000 |
I have setup a postfix relay docker container which is binding to port 25. I want to be able to use the mail command from the host CLI, but every time I install mailutils via apt it installs postfix as well.
How can I install JUST mailutils so I can access the mail command without installing postfix?
|
apt update
apt purge postfix mailutils -y
apt autoremove -y
rm /etc/postfix/ -R
reboot
apt install mailutils sendmail -y
apt purge postfix -y
apt autoremove -y
systemctl stop sendmail
systemctl disable sendmail
reboot
| Install Mail or Mailutils without postfix |
1,425,123,351,000 |
I installed Bugzilla on my CentOS 7 web server VPS. The install went smoothly, however when I went to set up email, I received the following error:
Can't locate object method "quit" via package "Net::SMTP::SSL" at Bugzilla/Config/Common.pm line 365.
For help, please send mail to the webmaster (********), giving this error message and the time and date of the error.
I set the email configuration to connect to Office 365, which means:
SMTP Server: smtp.office365.com:587
smtp_ssl: on
Username/password/mailfrom: that of the email address that I am using.
I viewed the source file, Config/Common.pm, in question:
344
345 sub check_smtp_server {
346 my $host = shift;
347 my $port;
348
349 if ($host =~ /:/) {
350 ($host, $port) = split(/:/, $host, 2);
351 unless ($port && detaint_natural($port)) {
352 return "Invalid port. It must be an integer (typically 25, 465 or 587)";
353 }
354 }
355 trick_taint($host);
356 # Let's first try to connect using SSL. If this fails, we fall back to
357 # an unencrypted connection.
358 foreach my $method (['Net::SMTP::SSL', 465], ['Net::SMTP', 25]) {
359 my ($class, $default_port) = @$method;
360 next if $class eq 'Net::SMTP::SSL' && !Bugzilla->feature('smtp_ssl');
361 eval "require $class";
362 my $smtp = $class->new($host, Port => $port || $default_port, Timeout => 5);
363 if ($smtp) {
364 # The connection works!
365 $smtp->quit;
366 return '';
367 }
368 }
369 return "Cannot connect to $host" . ($port ? " using port $port" : "");
370 }
371
What I deduced is that the connection information was a success and that Bugzilla was merely trying to quit the connection and return, no errors.
I found this article on the internet regarding this problem.
Mr. Thorsten Schoning said:
Then debug further: Check the version of your installed
Net::SMTP::SSL, have a look at the source if a "quit" method is
available etc. There should be a file Net/SMTP/SSL.pm somewhere in your
perl installation or wherever and however you install packages. If
you have used install-module.pl, empty the bugzilla/lib folder and
install missing packages again using your package manager.
Additionally look at the mentioned line of the Bugzilla code to see
what Bugzilla thinks: It thinks you have Net::SMTP::SSL available,
expects an available method and that seems to be missing. You need to
find the reason why because from my understanding it should be
available.
Well, I did a locate for SSL.pm and came up with:
[root@tkts-wtsc /]# locate SSL.pm
/usr/lib64/perl5/vendor_perl/Net/SSL.pm
/usr/share/perl5/vendor_perl/HTTP/Daemon/SSL.pm
/usr/share/perl5/vendor_perl/IO/Socket/SSL.pm
/usr/share/perl5/vendor_perl/Net/MQTT/Simple/SSL.pm
/usr/share/perl5/vendor_perl/Net/SMTP/SSL.pm
/usr/share/perl5/vendor_perl/Net/Server/Proto/SSL.pm
/usr/share/perl5/vendor_perl/Software/License/OpenSSL.pm
I viewed the contents of Net/SMTP/SSL.pm, but that did not contain any subroutines. I then viewed the contents of /Net/SSL.pm and saw subroutines/methods, but none of them quit, but then quit is an SMTP command, so I am not surprised there. Not sure if Mr. Schoning's response means anything or not, but even HIS linked SSL.pm source does not contain a quit method.
I did a sudo yum install mod_ssl openssl as mentioned somewhere else and I get already installed and latest version, nothing to do.
I did a sudo yum install perl-Net-SMTP-SSL and got Package perl-Net-SMTP-SSL-1.01-13.el7.noarch already installed and latest version. I installed all packages and updated everything.
This question is a server setup issue, not a programming one, hence my placement of this question here and not on SO. I merely mention the source files, as the error mentioned it and I wanted to be complete and give all the details.
I set the permissions for key folders:
drwxr-x--- 2 jmr-admin psacln 4096 Oct 17 08:33 Config
-rwxr-x--- 1 jmr-admin psacln 13547 Oct 16 16:55 Config.pm
and all items in the Config folder are the same as:
-rwxr-x--- 1 jmr-admin psacln 16836 Oct 16 16:55 Common.pm
Now that I am writing this question, I do not think the issue is permissions, as perl found the SMTP module, not to mention SSL module, successfully did a test and was attempting to quit the connection, when perl could not find the quit method.
I DID turn On the smtp_debug option, but I got no additional details.
I found this reference, lot of good information, such as to include the port in the SMTP server field, which I originally forgot to do. Sadly, this reference did not resolve my problem. For what it is worth, I also tried my gmail account, as this article references Gmail. In that way, I could enter the information EXACTLY as on this page. I copied and pasted the information. I got the same error, immediately with no delay. That was a bit weird, as I would have expected a slight delay from either Gmail or Office 365, but whatever.
UPDATE
I am still looking and ran into this article. The result of sesstatus -b is SELinux status: disabled. That is possibly another problem, but not relating to my inability to send emails. If anything, it is a good thing for troubleshooting. Anyways, I discovered that there is such a thing as /var/log/httpd/error_log. The contents of this file are (keeps repeating for every attempt):
[Thu Oct 17 09:17:22 2019] editparams.cgi: *******************************************************************
[Thu Oct 17 09:17:22 2019] editparams.cgi: at Bugzilla/Config/Common.pm line 362.
[Thu Oct 17 09:17:22 2019] editparams.cgi: Can't locate object method "quit" via package "Net::SMTP::SSL" at Bugzilla/Config/Common.pm line 365.
[Thu Oct 17 09:23:07 2019] editparams.cgi: Odd number of elements in hash assignment at /usr/share/perl5/vendor_perl/IO/Socket/IP.pm line 336.
[Thu Oct 17 09:23:07 2019] editparams.cgi: *******************************************************************
[Thu Oct 17 09:23:07 2019] editparams.cgi: Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
[Thu Oct 17 09:23:07 2019] editparams.cgi: is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
[Thu Oct 17 09:23:07 2019] editparams.cgi: possibly with SSL_ca_file|SSL_ca_path for verification.
[Thu Oct 17 09:23:07 2019] editparams.cgi: If you really don't want to verify the certificate and keep the
[Thu Oct 17 09:23:07 2019] editparams.cgi: connection open to Man-In-The-Middle attacks please set
[Thu Oct 17 09:23:07 2019] editparams.cgi: SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
[Thu Oct 17 09:23:07 2019] editparams.cgi: *******************************************************************
[Thu Oct 17 09:23:07 2019] editparams.cgi: at Bugzilla/Config/Common.pm line 362.
[Thu Oct 17 09:23:07 2019] editparams.cgi: Can't locate object method "quit" via package "Net::SMTP::SSL" at Bugzilla/Config/Common.pm line 365.
~
This log shows that I have another side task to fix a deprecated CentOS setting and limit a Main-In-The-Middle attack, but that does not appear to be germane to my quit method nonexistence issue. I have to research that a bit more.
The real error is line 362. That should have probably returned null / false to indicate an error. I bet that had line 362 really succeeded, then the quit method would exist. Sadly, I this environment is not under Visual Studio, where I can set a breakpoint and view contents. I am in server admin mode, so...
my $smtp = $class->new($host, Port => $port || $default_port, Timeout => 5);
Okay, I found this article, which helped me solve the SSL_VERIFY_NONE warnings. I opened up /usr/share/perl5/vendor_perl/IO/Socket/SSL.pm did a vi command, :set number, and then issue the command, /DEFAULT_SSL_ARGS, which took me to line 35. I then changed on line 49 from SSL_verify_mode => SSL_VERIFY_NONE, to SSL_verify_mode => SSL_VERIFY_PEER,. I then saved my changes and quit. I tried my email settings again and much better.
[root@tkts-wtsc Config]# vi /var/log/httpd/error_log
[root@tkts-wtsc Config]#
[Thu Oct 17 09:23:07 2019] editparams.cgi: possibly with SSL_ca_file|SSL_ca_path for verification.
[Thu Oct 17 09:23:07 2019] editparams.cgi: If you really don't want to verify the certificate and keep the
[Thu Oct 17 09:23:07 2019] editparams.cgi: connection open to Man-In-The-Middle attacks please set
[Thu Oct 17 09:23:07 2019] editparams.cgi: SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
[Thu Oct 17 09:23:07 2019] editparams.cgi: *******************************************************************
[Thu Oct 17 09:23:07 2019] editparams.cgi: at Bugzilla/Config/Common.pm line 362.
[Thu Oct 17 09:23:07 2019] editparams.cgi: Can't locate object method "quit" via package "Net::SMTP::SSL" at Bugzilla/Config/Common.pm line 365.
[Thu Oct 17 11:19:04 2019] editparams.cgi: Odd number of elements in hash assignment at /usr/share/perl5/vendor_perl/IO/Socket/IP.pm line 336.
[Thu Oct 17 11:19:04 2019] editparams.cgi: Can't locate object method "quit" via package "Net::SMTP::SSL" at Bugzilla/Config/Common.pm line 365.
~
I am down to only 2 lines. What is interesting is that i do not get the complaint anymore about line 362. Hmm.
If anyone is curious, here is the code to IP.pm at line 336:
[root@tkts-wtsc Config]# vi /usr/share/perl5/vendor_perl/IO/Socket/IP.pm
[root@tkts-wtsc Config]#
325
326 As a special case, if the constructor is passed a single argument (as
327 opposed to an even-sized list of key/value pairs), it is taken to be the value
328 of the C<PeerAddr> parameter. This is parsed in the same way, according to the
329 behaviour given in the C<PeerHost> AND C<LocalHost> PARSING section below.
330
331 =cut
332
333 sub new
334 {
335 my $class = shift;
336 my %arg = (@_ == 1) ? (PeerHost => $_[0]) : @_;
337 return $class->SUPER::new(%arg);
338 }
339
(Sorry about the long question, more like me keeping notes, but I am hoping that others might benefit from all this information and the methodology that I used. There is virtually nothing out there, and if I ran into this bug, others will too.)
Anyways, so how do I fix the problem?
|
Mr. Schoning's answer is not wrong and did lead me to the solution. Basically, for the specific error I just did not see (understand more than likely) that very last response in the following link, where the author said that he had to run the following command. I executed the command and presto, instant success with emails.
Link to other Customer with Problem
thanks solved using 'cpan upgrade Net::SMTP::SSL' command
For others, and for that matter a possible future me, I will explain things.
Before that, however, even though Bugzilla works (UI is fine, ability to add users, projects, etc. are all fine), the ./testserver.pl script still fails with being able to read padlock.png.
Feature Requests
There is no "theme" support. The gray is drab. Also, upgrades should be simpler.
I can imagine either an automatic update or a button that when pressed updates the software, much like Plesk.
Write-up
There is a misunderstanding on how things went down and even if I followed the official Bugzilla docs originally, which I later did, the docs was still incomplete and not applicable to my environment. Also the local configuration file, ./localconfig, is missing a field for the user, not just the group to use.
Before continuing, here is my environment:
CentOS 7 running Plesk Obsidian in a VPS (what Media Temple calls "DV")
The HTTPD configuration file, /etc/httpd/httpd.conf, showed that the user and group for HTTPD are both "apache". That is what the Bugzilla documents said to use in the ./localconfig file too! Sadly, that is wrong. The correct answer is "psacln" for the group. The best way to figure that out is to create a new temporary subdomain and look at the owner and group of the default files. In my case the answer is "jmr-admin:psacln". Placing psacln in the Bugzilla configuration file took care of the group policy. That means the two changes for apache are:
# If you set this to anything other than "", you will need to run checksetup.pl
# as root or as a user who is a member of the specified group.
$webservergroup = 'psacln';
# If set to 1, checksetup.pl will set file permissions so that Bugzilla
# works in a SuexecUserGroup environment.
$use_suexec = 1;
I had to manually change the user from "root" to "jmr-admin" after I reran ./checksetup.pl.
There are NO direct changes to /etc/httpd/httpd.conf. Nobody on any platform should make changes there, as that file gets overridden. If anything create a custom configuration file and place in the /etc/httpd/conf.d/ directory. The httpd configuration file, httpd.conf, automatically reads this directory. For my case adding something there IS WRONG and messed things up. The correct thing to do is one of two things:
1) (best way): Add a .htaccess file and set the contents to:
#CGI
DirectoryIndex index.cgi
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
Options +ExecCGI
#
2) Inside Plesk edit for the domain (or subdomain as in my case) environment, namely: [domain] > Apache & nginx Settings >
Handlers: Enter custom values
cgi-script .cgi
cgi-script .pl
Index files: Enter custom value (leave default ones)
Note: Using this leaves out the "Options +ExecCGI", though that does not seem necessary.
The best way to verify CGI is to create a brand new test subdomain and place a cgi script in the root directory, such as my testcgi2.cgi.
#!/usr/bin/perl
print "Content-type:text/html\r\n\r\n";
print '<html>';
print '<head>';
print '<title>Hello Word - First CGI Program</title>';
print '</head>';
print '<body>';
print '<h2>Hello Word! This is my first CGI program</h2>';
print '</body>';
print '</html>';
1;
If changes to Apache are fine, then the script will show this formatted text with no code:
Hello Word! This is my first CGI program
I then copied the files from the downloaded compressed file to the subdomain. You might have to set permissions to 755 on extra key files.
I did have to run the yum command as indicated in the CentOS 7 and Bugzilla docs.
I had to run that extra script to get SMTP working, so that I do not get that annoying lack of a quit method.
I did look at the original Bugzilla docs and at first thought that Chinese would be easier to read. At least I once saw the mini series Shogun on TV, though that was Japanese. I contacted my web host provider, who gave me the link to the Bugzilla CentOS 7 guide.
That was incomplete as that did not discuss permissions or Plesk or any of the changes that I said need doing. The Bugzilla docs, which now is less Chinese like and more English like after days of suffering would still not have gotten the job done. Letting my web host provider initially make changes was maybe good, so that I saw that the site could come up, but with a lack of explaining and the lack of my current knowledge everything was bound to quickly not work the next time that I ran the ./checksetup.pl script.
I think that covers everything. I am still not an expert by any stretch, but hopefully my write-up helps.
| Bugzilla error: Can't locate object method quit via package "Net::SMTP::SSL" line 365 |
1,425,123,351,000 |
I'm trying to setup mailx to use my Gmail account. I've found a configuration that can send mail successfully but it requires me to store my email password in a configuration file in my home directory. I would like to be prompted for the password every time rather than storing it.
I've tried leaving out the smtp-auth-password field where the password is present but the program does not prompt for a password and instead gives me this error: User and password are necessary for SMTP authentication.
Is there any way configure mailx such that my email password is used in a secure manner?
Here is my mailx config file:
account gmail {
set folder=imap://(removed)@imap.gmail.com
set smtp-use-starttls
set ssl-verify=ignore
set smtp=smtp://smtp.gmail.com:587
set smtp-auth=login
set from=(removed)@gmail.com
set smtp-auth-user=(removed)
set smtp-auth-password=(removed)
set nns-config-dir=~/.certs
}
|
Which version of mailx are you using?
heirloom-mailx 12.5 on Ubuntu 14.04 prompts me for the password every time if there's no smtp-auth-password setting in ~/.mailrc. This feature was added in 12.0 in March 2006 according to ChangeLog.
| Using mailx without storing a password |
1,425,123,351,000 |
Every day we receive an e-mail from e.g. [email protected] with an attachment, the filename is e.g. report.xlsx
How can I save the file with the received date? e.g. 20180131_report.xlsx and how can I filter on the subject or the sender?
My ~/.procmailrc:
:0
*^content-Type:
{
:fw
| ripmime --overwrite --no-nameless -i - -d /dir/to/save/attachment
}
|
If your Procmail or the receiving MTA is configured to put in a From_ line before the message proper, this pseudo-header generally already contains the date. You'll need to parse it, which is a drag, so unless this is a system where you really need to optimize for perfomance (hundreds of matches per second on this condition?) the absolutely easiest solution is to call date +%Y%m%d.
To match on either of two unrelated headers, just put them both in a regex with |:
:0
* ^Content-type:
* ^From:(.*\<)?foo@example\.tld|^Subject: Your daily report
| ripmime --overwrite --no-nameless -i - -d /dir/to/save/attachment/$(date +%Y%m%d)_report.xslx
(Bug here; see update below.)
The fw flags don't make sense in this context so I took them out (and actually I'm not sure the Content-type: condition makes a lot of sense either; most messages will have it anyway, these days).
If you have more complex conditions you want to combine, you can use a fundamental principle from logic called de Morgan's laws. There is no direct syntax in Procmail to say "this condition or that condition", but you can refactor this to "not ((not this condition) and (not that condition))."
:0
* ! this condition
* ! that condition
{ } # nothing happens here
:0E # else
{ LOG="at least one of them matched
" }
Or simply use scoring;
:0
* 1^0 this condition
* 1^0 that conditon
{ LOG="at least one of them matched
" }
Update:
It looks like ripmime doesn't actually support (extracting or) naming an individual attachment. The easiest solution is perhaps a cron job which renames the latest arrival a bit before midnight (or if you know when it arrives, a bit after the latest time you expect it):
55 23 * * * cd /dir/to/save/attachment && mv report.xslx "$(date +%%Y%%m%%d)"_report.xslx
Notice how (peculiarly) you need to double any percent signs in a cron command! You would obviously revert the Procmail recipe above to simply have ripmime save to /dir/to/save/attachment
Alternatively, I would rename the attachment right after it arrives, perhaps while also tightening the conditions considerably. The following includes a fair amount of guesswork as to how exactly the message which delivers the attachment is encoded -- it could choose between a number of different content types, MIME structures, MIME header conventions, etc, so it probably doesn't work without some tweaking.
:0
* ^From:(.*\<)?foo@example\.tld
* ^Subject: Your daily report
* HB ?? ^Content-type: application/(octet-stream|vnd\.openxmlformats-officedocument\.spreadsheetml\.sheet|vnd\.ms-here-be-dragons-xslx); filename="?report.xslx
| ( cd dir/to/save/attachment; \
ripmime --overwrite --no-nameless -i - -d . && \
mv report.xslx $(date +%Y%m%d)"_report.xslx )
The Content-type: header might not contain the filename; it could (and these days should) be specified in Content-Disposition: but many senders put it in both places for backwards compatibility. The filename should properly be RFC2231-encoded which means a number of optional fields could be populated where I have conveniently assumed they will be empty, like they were when ASCII filenames were the only game in town.
Notice also how I require the sender and the subject to match now. The HB ?? says (imprecisely) to look for a match either in the main message headers, or somewhere in the body. Properly speaking, the match should be in the headers of a MIME body part in the latter case, but Procmail has no easy way to specify this.
| procmail save attachment with received date in filename |
1,475,608,012,000 |
I have successfully installed Postfix/Dovecot with virtual domains and TLS support like this article describes -
https://geekpeek.net/postfix-with-dovecot/ ...
But faced with the problem. I can send emails only to people in my domain zone (blabla, as example). It means that I can send email from [email protected] to [email protected]. But when I'm trying to send email from my google account to this addresses I get next errors:
postfix/smtpd[19211]: connect from mail-wi0-f172.google.com[209.85.212.172]
Sep 10 18:23:17 amazon-ws.fs.local postfix/smtpd[19211]: NOQUEUE: reject: RCPT from mail-wi0-f172.google.com[209.85.212.172]: 554 5.7.1 <[email protected]>: Recipient address rejected: Access denied; from=<{myaccount}@gmail.com> to=<[email protected]> proto=ESMTP helo=<mail-wi0-f172.google.com>
Sep 10 18:23:17 amazon-ws.fs.local postfix/smtpd[19211]: disconnect from mail-wi0-f172.google.com[209.85.212.172]
Recipient address rejected: Access denied;
All i could understand is that my postfix server rejects this mail, but can't understand why. Postfix configuration (main.cf) attached below:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
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
default_process_limit = 100
html_directory = no
inet_interfaces = all
inet_protocols = all
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 10485760
mydestination = $myhostname, localhost.$mydomain, localhost
myhostname = amazon-ws.fs.local
mynetworks = 172.31.0.0/20, 127.0.0.0/8
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
queue_minfree = 20971520
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
sample_directory = /usr/share/doc/postfix-2.10.1/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_client_connection_count_limit = 10
smtpd_client_connection_rate_limit = 30
smtpd_recipient_limit = 1000
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/postfix/cert/postfix.pem
smtpd_tls_key_file = /etc/postfix/cert/private/postfix.pem
smtpd_tls_loglevel = 0
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_gid_maps = static:2000
virtual_mailbox_base = /var/mail/virtmailbox
virtual_mailbox_domains = /etc/postfix/virtdomains
virtual_mailbox_maps = hash:/etc/postfix/virtmail_maps
virtual_minimum_uid = 2000
virtual_uid_maps = static:2000
Operating system: RHEL7.1, Postfix Version 2.10.1
Where is the problem?
|
As @alexkowalski mentioned, the problem that there was a short parameter (-o) in master.cf file not in the `main.cf file.
Because -o options in master.cf can override the options written in main.cf on a per-service basis, the smtpd_recipient_restrictions param value were being taken from the master.cf file.
Notice the smtpd_recipient_restrictions param :
smtps inet n - y - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_reject_unlisted_recipient=no
-o smtpd_client_restrictions=$mua_client_restrictions
-o smtpd_helo_restrictions=$mua_helo_restrictions
-o smtpd_sender_restrictions=$mua_sender_restrictions
-o smtpd_recipient_restrictions=
-o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
-------> -o smtpd_recipient_restrictions=permit_sasl_authenticated, reject
By commenting that line and every other -o line that I don't want, the values written in the main.cf file are the taken values.
| Postfix: Recipient address rejected from another domain zones |
1,475,608,012,000 |
I am currently using wall to show a message on a remote machine when an activity is started and finished.
But this is intrusive, as it will write across an editor they might have open etc.
What I like is the "you have unread mail message" that shows up on the next line if the user presses return on the terminal.
What is this, and how can I interact with it remotely?
|
This line is printed by the shell. Different shells implement looking for mail in slightly different ways, but unless can count on people to configure their shells to your liking (and possibly pick a different shell), you need to send them mail.
Good shells designed for interactive use have a way to run arbitrary commands before displaying a prompt, in addition to the built-in mail notification. You can have your users cat a file there, or do something more complicated. For zsh users, put this in ~/.zshrc:
precmd () {
if [[ /etc/sysadmin-message -nt ~/.sysadmin-message-timestamp ]]; then
cat /etc/sysadmin-message
touch ~/.sysadmin-message-timestamp
fi
}
For bash users, put this in ~/.bashrc:
PROMPT_COMMAND='
if [[ /etc/sysadmin-message -nt ~/.sysadmin-message-timestamp ]]; then
cat /etc/sysadmin-message
touch ~/.sysadmin-message-timestamp
fi
'
| How to send a prompt to a remote machine like the "you have mail", ie not using wall |
1,475,608,012,000 |
I got a mailbox-file ("Mboxrd") created by getmail, and I'd like to "process" it by sorting mail from various (groups of) senders, and move them to separate mailbox-files (I guess 3-5 for now). Ideally, the mail messages thus moved, should be deleted from the original mailbox-file.
I most likely would want to classify mail by the sender-address - although being able to classify it by Subject (ie. certain words/phrases) would also be nice...
Now, if this had been messages just received on my computers MTA - or if I'd set-up getmail to deliver mail to the MTA - I guess I could use procmail the normal way... However, what I got is a "dead" file with already stored mail-messages, so that's not an option. I guess I could send the mail through the MTA, but surely there must be a way to process the mail as it is (in the file)?
So, is there a program or command - or some special options to procmail or a similar command - that lets me "sort" the mail in a mailbox-file into several other mailbox-files, based on the sender/subject of the messages? A small example (eg. of the config-file) would also be appreciated...
|
The formail -s method is documented with a demo script in the procmail man page; look for this phrase:
Procmail can also be invoked to postprocess an already filled system mailbox.
You would also find this in http://www.iki.fi/era/procmail/mini-faq.html#split
If your mailbox is not a Berkeley mbox single file, chances are you have a directory where each file is an individual message. In this case, you can process it simply with
for f in folder/*; do
procmail -options <"$f"
# maybe rm "$f" to remove the original after processing completes
done
As an example of how to filter by sender, a simple recipe would be something like
# If your mailbox destination is maildir, no locking is required
:0: # so you could lose the second colon here, and in subsequent examples
* ^From:.*\<alice@example\.com\>
alice
:0:
* ^From:.*\<bob@example\.net\>
bob
etc. This examines the "From:" header which is usually what people mean by "sender", though there are two other fields in common use (the envelope sender, which is usually in Return-Path:, and the actual Sender: header which is optional, but frequently populated by the sending software when the From: header is not the actual sender).
Similarly, to classify by Subject:, simply specify a regex which matches the subjects you want to capture.
:0:
* ^Subject: *((Fwd?|Re): *)*\[gunk]
gunk-list
would find messages with Subject headers which contain the label [gunk], optionally preceded by whitespace and/or Re: and/or Fw: and/or Fwd:.
| Processing/sorting mail from a mailbox-file? |
1,475,608,012,000 |
I'm using alexkowalski script from Email using shell script
MAILADDR=([email protected], [email protected], [email protected])
for i in "${MAILADDR[@]}"
do
echo "Mail test..." | mail -s "Mail test subject..." $i
done
My question is how to read MAILADDR array from an external flat file?
And how to insert an external flat file replacing the body of the email as in
echo"/home/user/information-for-any-user.txt" | mail -s "Mail test subject..." $i ??
|
If the "external flat file" from which the email addresses are taken from doesn't look too funny (is well formatted), you could use something like that :
mail -s "My subject" $(cat /this/is/the/external/flat/file.txt) < /home/user/information-for-any-user.txt
| Email using shell script using email address from external flat file |
1,475,608,012,000 |
I'm using the ssmtp package to send e-mail via g-mail. Everything is working fine with it - the only strange thing is that if I send mail via the command line, the "to field" is funky.
ssmtp [email protected] < message.txt
Basically the "to" field will just say "undisclosed recipients"
I read that you can set headers containing a "To:" field, but that seems overly complicated when I've used the mail command on other systems, I it will do this automatically.
Is there an easier way to send mail via the command line with ssmtp - but without having to change the above syntax or specify additional parameters? (possibly a config file to set the "to" address as whatever one was specified.
|
This situation comes from a misunderstanding of what ssmtp is doing. There's a very important difference between the message envelope (which mail servers use for routing mail) and the message body (which is displayed in your e-mail client). Both may have To and From, and they may be different from each other. This is okay!
ssmtp merely creates the envelope and facilitates transferring the message to the MTA. It expects the body you pass it to fully formed and contain all body headers. It will not add any for you*, (although it will insert message handling headers, e.g., Received-by, et al.). I'm sure you've also noticed that there is also no Subject: with those messages.
So the answer to your question is that the To: field needs to be included in message.txt.
To make the To: and Subject: fields show up you need to format message.txt like this:
To: [email protected]
Subject: Message for you
Message text starts here.
blah blah blah.
*That's not exactly true. Since a From: header is the only required header one will be derived from the envelope and inserted if it is missing.
| Can I make SSMTP to automatically set the "To:" header? |
1,475,608,012,000 |
How can I convert (or open) .ost file (Microsoft Outlook email folder) on linux ?
Ideally, I would like to read it with Mutt. But mutt does not seem to understand this format. Therefore I would like to convert it into something readable such as mbox or mdir format.
Are there such conversion tools on linux ?
|
There are a few tools which help with interoperability with Outlook files:
libpff, which includes a pffexport program which can extract data from OST (and other) files;
Evolution has a PST import plugin which can handle OST files;
libpst, which can convert PST files to mbox files, but I don’t know whether it can handle OST files.
pffexport should at least allow you to view the contents of the emails.
| how to open/convert .ost file (Microsoft Outlook email folder) on linux |
1,475,608,012,000 |
I'm running FreeBSD 11.0-RELEASE.
On default cron is using /usr/lib/sendmail to send user emails. How can I tell/set cron to use /bin/mail instead?
FreeBSD is using the cron version from Paul Vixie, so the -m option sets the email receiver not what mailer to use.
I downloaded the FreeBSD source code and tried the command # make config in /usr/src/usr.sbin/cron/, that ofc does not work since config is not defined. But I think that's an bad idea anyway cause future updates could easy overwrite this?
Thanks for your help!
|
cron by default uses the value of the systemwide _PATH_SENDMAIL macro as the expansion of MAILCMD, the command to use to send messages generated by jobs. In order to use a different mail program, you need to modify the Makefile to define appropriate values for the MAILCMD and MAILARGS macros. The Makefile in the source tree includes commented definitions illustrating possible values, but there appears to be a slight bug in the MAILARGS macro that applies when MAILCMD is defined to be /bin/mail - it has two string expansions, but only receives one string when called, so in the patch in the gist, I removed the first of the expansions.
If you have the patch utility installed (it's in ports, if not), apply this patch (relative to /usr/src/usr.sbin/cron) and build/install cron:
% cd /usr/src/usr.sbin/cron
% make
% make install
Restart cron, and you should now be using /bin/mail. N.B. this patched version builds cleanly on my system (11-STABLE), but I have not tried using it in place of the default version. Remember that you'll probably need to do this again when you upgrade, since the FreeBSD default is to use /usr/lib/sendmail.
| Change cron default sendmail to mail |
1,475,608,012,000 |
I just set up a VPS with Debian 7 x64, and removed Sendmail along with some other programs. When it removed Sendmail, it also installed Exim. When I removed Exim, it installed xmail.
Is there any reason why it seems to require a mail program?
I used apt-get remove --purge sendmail* exim* to remove them
|
One of your installed packages depends on installed MTA. This is most likely cron. You can view why a package (or meta package) is installed with aptitude:
aptitude why mail-transport-agent
| Why does uninstalling sendmail install exim, and uninstalling exim installs xmail? |
1,475,608,012,000 |
Suppose I run -
mail goldfish
There is no such account on the system and no such aliases defined, where would the mail go?
How do I see a list of such mails?
|
The email would be returned to the sender as undeliverable due to lack of a destination address by the mail daemon on the destination server.
| Where do uncaught local emails go? |
1,475,608,012,000 |
Last week my email provider (mout.web.de) got listed on spamcop. So I cannot send emails to recipients whose mailserver uses spamcop. An obvious solotion, which popped up in the forums, is to switch to another (paid) email provider.
Since I have a local mailserver (exim) running anyways, I wonder whether I can set it up in way so it delivers mail directly rather than sending it to a smarthost, as it does now. If spamcop then detects spam originating from my IP, I am willing to take the blame.
However I do not own my own domain (just a dynamic dns listing) and I am worried that this could be a showstopper.
I also vaguely recall, that years ago a friend of mine tried to deliver mails directly and ran into problems, beause some mailservers would refuse to accept mail from him (the exact details slipped my memory).
So
Is running my own mailserver (without smarthost) a vital alternative to switching to a different email provider?
Will I have to register my own domain?
Are there any other showstoppers? Is there anything an email provider can do, which I cannot do on my linux box?
|
In general this is possible, that's what email providers do.
You surely need your own domain.
Many ISPs have blocks in place so you're forced to go over your ISPs server.
Even if your ISP does not block port 25, mail from your IP range will very likely be marked as spam if you run it from a home connection.
Email is a complicated and critical piece of the infrastructure which takes some effort to secure. Furthermore, you will have to put additional effort into making it reliable (redundancy, failover, etc.)
Conclusion
Although it's possible to set it up on your own, renting a server in a data centre or paying an email provider if you want a reliable operating mail setup without a high risk of being marked as spammer is often the better solution.
| Is it possible to run a private mailserver? |
1,475,608,012,000 |
Let's say, we have multiple mail servers in DNS records. If someone is sending a mail, the outgoing mail server will check the MX and contact the first server with the lowest cost.
If this server doesn't have the requested mail address, what happens then? Does the outgoing mailserver send the message to the second mailserver in the MX record? Or does that depends on the error message by the first mailserver?
How are messages to "unknown addresses" handled? By the first server attempting to deliver them to the appropriate MX mailserver, or does the MX mailserver attempt to resolve this?
|
SMTP and ESMTP (the underlying protocols) that handle mail delivery have extensive RFCs (the original being RFC821, and more modern update RFC2821 and a Internet standards track protocol in RFC5321).
How mail servers deal with errors during delivery varies from mail server to mail server. Adding to the complication is the fact that a lot of them are configurable and easy to change the default behavior outlined in the RFCs.
The general rule of thumb, given the above caveats is:
Pick the highest preference MX record, or one at random if several records of the same preference exist (some times the random behavior is instead a round-robin algorithm). If the chosen host is "unreachable" (no route to host, connection refused or similar), try the next MX record of same preference or lower. As msw has mentioned, these are some what counter intuitive - the highest preference is 0 and records of a higher number are considered less preferential.
This is repeated until a connection is established, OR all hosts fail to respond, in which case the email is re-queued for later attempt at redelivery. Most mail servers will attempt this for a certain amount of time (usually something like 1 to 2 days), before it gives up and returns the email in a Non-Delivery Report (NDR).
If the connection is successful, the various steps of the RFC protocol dictate the general behavior of connecting MTAs. From the initial banner sent by the remote mail server, to each of the various command issued to it (from EHLO/HELO, through MAIL FROM, RCPT TO and DATA statements), the general rule of thumb is:
4xx transient error, try again later
With this code, the email is re-queued by the local mail server and delivery attempted at a later time (configured in the settings of that local mail server)
5xx fatal error, mail undeliverable
With this code, the email is considered undeliverable and the local sending mail server will (not always, but on most servers) generate an NDR (Non-delivery Report).
In terms of your question "If this server doesn't have the requested mail address", at RCPT TO stage, most servers would respond with a 5xx code and your local mail server would generate an NDR.
Not all email servers are created equal
There are some caveats to this. MS Exchange for the longest time, would accept ALL emails regardless of incorrect recipients, unroutable domains and so forth, and then generate an NDR after the fact. Certain ISPs due to issues with spam and phenomenon known as Back Scatter, do not even generate NDRs and your mail "silently fail" (you never receive any notification of failed delivery).
You also have to take into consideration that the MTA (Mail Transport Agent, or mail server) is not always the end-point of delivery and MDAs (mail delivery agents - such as procmail) and MUAs (Mail User Agents) or "mail clients" such as thunderbird/outlook etc can be configured to "return" those emails with their own NDR-like responses. There are also such mechanisms as .forward files which can get the MTA to redirect the email to another address after acceptance of the email. Certain mail servers (I know this is the case for Exim), will attempt to expand the .forward at the point of the RCPT TO stage of the SMTP conversation and if that expands to an unroutable address reply with the 5xx series of error codes mentioned above.
For a much more accurate and in-depth explanation read the RFCs mentioned above and the documentation of the MTA you are using (remembering that how it is configured may play a part in its behavior).
| Question about MX records and mail delivery? |
1,475,608,012,000 |
I'm setting up a Debian server, and one of the things I need on it is an MTA. I don't want to use something like Exim or Postfix because I want something that ties in SMTP, POP3, and IMAP all in one (a la Microsoft Exchange). Most MTAs also seem to be hellishly difficult to configure. Try and read the Exim documentation; you could do a university degree on it (I'm not kidding).
When you can get an HTTP server like Cherokee which is easy to configure and has a nice web interface, do MTAs or groupware solutions need to be that hard? I'm aware that some people think "the Unix way" is to have lots of different interacting pieces of software (like maybe an SMTP MTA, POP3 service, webmail service, and overarching manager to tie them all together), but I think this is a situation where that just makes things a lot harder to deal with and one large software suite fits in much more nicely. So, I'm looking for good open source software suites that will run on Debian that:
Combine (at least) SMTP, POP3, and IMAP
Are easy(ish) to configure
Have a nice configuration web interface or GUI
Are not defunct projects
I don't mind if it's groupware and offers calendaring too, but I would only be using the e-mail functionality for now. Another nice-to-have would be built-in webmail (if we're combining a bunch of functionality, why not?)
The suites I've found so far that seem to match the above criteria (and have appropriate licenses) are Citadel, Kolab, and Zimbra. I'd appreciate anyone who has experience with any of these giving me the pros and cons of them, such as how easy they are to configure and what their performance is like. I'd also appreciate any other suggestions for solutions that fulfil my criteria that I may have missed out.
|
One of the few suites I've found that actually bundles this functionality into one and has a mostly graphical interface is Citadel. It's not perfect but it does somewhat fit the bill.
| Recommendations for good MTA / groupware solutions? |
1,475,608,012,000 |
I've got some large mailboxes and using Thunderbird, that means that I have several mbox files. These single files contain all e-mails in a particular folder. Now, I would like to get some data on the senders in a particular folder. My ideal statistic would be to get all unique senders, and the number of times their e-mail is in that folder. Ej:
John A: 10x
Maria B: 5x
etc.
I've tried some grep options but I also get X-headers if I grep only 'From:', and I'm not sure how to exclude these other headers. Anybody any idea if this can be done from the command line?
|
First, we need to reliably get the From header, which can be done with a restrictive grep regular expression.
% grep --no-filename --ignore-case '^From:' test.eml
From: [email protected]
Next we need to count the number of occurrences, which can be done with uniq -c (which requires a sorted list).
% grep --no-filename --ignore-case '^From:' *.eml | sort | uniq --count
1 From: [email protected]
3 From: [email protected]
We can then sort the output by occurrence, to get the most frequent at the top.
% grep --no-filename --ignore-case '^From:' *.eml | sort | uniq --count | sort --general-numeric-sort --reverse
3 From: [email protected]
1 From: [email protected]
| Creating a list of unique senders from Thunderbird mail files through the command-line |
1,475,608,012,000 |
When i send email it sleep in my queue list. How can i send them out? (Fedora 15 distro).
# mailq
/var/spool/mqueue (2 requests)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
pBMNMDA1009288* 2100 Fri Dec 23 00:22 <apache@example>
<[email protected]>
pBMNIjU5009236 2100 Fri Dec 23 00:18 <apache@example>
(Deferred: Connection timed out with aspmx3.googlemail.com.)
<[email protected]>
|
Whenever sendmail has to deliver mails to other hosts which cannot be reached at that time, the messages are kept in the queue and are marked as “Deferred: Connection timed out”. Although the other hosts could be reached again and you want to tell sendmail to flush the mail queue, the command
sendmail -q -v
does not really try to reconnect to these hosts and still assumes that the connection timed out. The reason is that the hoststatus is cached, per default for a period of 30 minutes. Using sendmail -OTimeout.hoststatus=0m -q -v
you can re-run the mail queue and force sendmail to reconnect to the hosts.
Alternatively, if you want to do a selective flush on perticular domain or user or recepitience mail to delete, use this command
sendmail -qS -v apache # it will delete all mail from *@apache
sendmail -qR -v a.com # it will delete all mail destined for recepient at user of a.com
| How to send the email which is sleeping in my queue list? |
1,475,608,012,000 |
I'm developing a Thunderbird extension and I would like to setup a fake POP3 account to play with. What's the easiest way to setup a local POP3 server? It doesn't need to be particularly secure/robust, as it's meant only for local testing purposes.
|
Dovecot or Courier is probably your best bet.
http://wiki2.dovecot.org/POP3Server
http://www.courier-mta.org/install.html#pop3
| How to setup a local POP3 server? |
1,475,608,012,000 |
Cannot open an .mbox file with mutt
I want to open a 10GB .mbox file that I downloaded from my gmail account. When I use the command
neomutt -f 10GB_mboxfile.mbox
neomutt takes 10-20 seconds to open and when finally opened, there is no file listed in the the application. I have the following dummy .mbox (which I modified from a gmail mbox file):
From 9999999999999999@xxx Tue Mar 09 17:00:00 +0500 2019
X-GM-THRID: 99999999999999999
X-mail-Labels: Archived,Sent,Opened
MIME-Version: 1.0
Date: Tue, 09 Mar 2019 17:00:00 +0500
Message-ID: <[email protected]>
Subject: THETITLE
From: My Name <[email protected]>
To: [email protected]
Content-Type: multipart/alternative; boundary="0000000000009999999999999"
--0000000000009999999999999
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ da=
s ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
--0000000000009999999999999
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div>ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ=
ZZ das ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ=
>
--0000000000009999999999999--
I am trying to open it with neomutt as follows:
neomutt -f themboxfile.mbox
neomutt opens but then no message is listed in the app. How is it possible to open this file with neomutt? (Although opening the same file works with mutt...)
EDIT
Beside the answer below I had a too old version: the apt get install neomutt on Ubuntu LTS 22.04 installed the version 20211029. I uninstalled neomutt and re-installed it with nix package manager. it installed NeoMutt 20231221 which worked without problem.
|
It looks like neomutt doesn't like those timezone offsets in the From_ lines.
After:
sed -Ei 's/^(From .*) [-+][0-9]{4}/\1/' file.mbox
To remove them, it seems to be happy.
RFC4155 which specifies the mbox format says the timestamp should be UTC and in ctime() format, but acknowledges that in practice many applications deviate from that standard. That timestamp is about when the email was added to the mbox, so is not that relevant and not showed by default by (neo)mutt.
| Cannot open an .mbox file with neomutt (although it works with mutt) |
1,475,608,012,000 |
So I have an ancient archive of emails and I want to combine them into one big happy text file, can that be done? I notice when I view an email and cut and paste the content I get exactly what I want -- all the formatting is gone and I have a readable text file, all the meta data is gone along with all the HTML stuff. I've looked at 'html2text' but it leaves all the tags in, whereas I'd have thought it would strip them out. I could view, cut and paste, but that would take a long time.
BTW I use Thunderbird if that matters. I don't think I can do this within the program, it's going to be some command line utility I expect.
|
A scripted solution using:
formail (comes with procmail) to convert the emails to mailbox format
mutt to decode the mime stuff
elinks to convert HTML to text for those emails that don't have a text/plain alternative
zsh to orchestrate the lot and find the eml files in the current working directory and below.
#! /bin/zsh -
MAILCAPS==(
print 'text/html; /usr/bin/elinks -force-html -dump %s; copiousoutput'
) mutt -F =(<<'EOF'
set pipe_decode
set pipe_split
alternative_order text/plain text
unset wait_key
auto_view text/html
push "<tag-pattern>~A<enter><tag-prefix-cond><pipe-message>formail>>out.mbox<enter><exit>"
EOF
) -f =(for f (**/*.eml(n.)) formail < $f) > /dev/null
The text is appended to the out.mbox file. That file can still be opened as a mail folder by most mail user agents (don't know about Thunderbird) and should be plain text with most headers weeded.
If you don't care about the file being in mailbox format, you can replace the formail>>out.mbox with cat>>out.txt, and if you don't care about headers, with sed '1,/^$/d'>>out.txt.
Check the elinks man page for how to tune the HTML to text rendering if needed.
| export/convert emails (.eml files) to plain text |
1,475,608,012,000 |
I executed the "mutt" command and it only showed me the inbox mails.
How should I view the sent emails? If I want to send a new mail against the first delivered mail, how should I do it?
I added set record=+outbox in the .muttrc file but it didn't work.
Thanks in advance.
|
Option 1: If your sent message folder is "outbox" (I assume you are using Maildir format for mail, so actual path is ~/Maildir/outbox), then you can start mutt with the command:
mutt -f ~/Maildir/outbox
or
mutt -f =outbox
(= is a shortcut used by mutt to indicate a subfolder of your Maildir)
Option 2: When viewing inbox, press the c key. If your mutt is properly configured you should see a list of folders in your Maildir. Select the folder you want and press Enter.
I don't understand what do you mean by "send a new mail against the first delivered mail"? Do you mean reply to the received mail? If yes, this is done by pressing the r key on that mail.
| How to view the sent mails in Mutt? |
1,475,608,012,000 |
I need to send myself a database backup from a remote docker container running Ubuntu. I ssh into the container and run:
uuencode dbexport.pgsql | mail -s "DB" [email protected]
It seems to hang forever so I run only the first part:
uuencode dbexport.pgsql
Which also seems to hang forever. Any suggestions to debug this?
|
The command to uuencode a file should be:
uuencode dbexport.pgsql dbexport.pgsql
where the 1st name is the actual filename, and the 2nd the destination name for a possible restore in a different file.
So the correct way seems more like:
uuencode dbexport.pgsql dbexport.pgsql | mail -s "DB" [email protected]
I actually prefer to install mpack
sudo apt-get install mpack
and to send an email in MIME format, would do:
mpack -s "DB" dbexport.pgsql [email protected]
| uuencode hangs? |
1,475,608,012,000 |
I have to move my Alpine account/mail/address book from an old pc to a newer one. I'm searching through the documentation and can't find useful informations about this.
As Alpine is installed to the second pc, copying the /home/old_username/mail directory of the old pc over the /home/new_username/mail directory of the new pc (created by Alpine after installation) is enough?
|
There are 3 files and a directory that I'm aware of, that you will need to copy.
The file ~/.pinerc. This is the Alpine config file.
The file ~/.addressbook. This is the Alpine addressbook.
The file /var/spool/mail/username. This is the inbox for user username. NOTE: apparently the "real" location is now /var/mail, and /var/spool/mail which is now a symlink to that. But I'm still using /var/spool/mail from force of habit.
The directory where Alpine stores its mail folders. This is
configurable and defaults to ~/Mail. It's controlled by the
variable folder-collections in ~/pinerc.
| How to move Alpine mail on a different machine on Ubuntu? |
1,475,608,012,000 |
I'm currently struggling against a tenacious problem while setting up client certificate authentication for our mailservers via an NginX reverse proxy.
The setup seems to be working in most parts without the client certificates. But when I enable the checking of those and run a test with openssl s_client I allways get:
Verify return code: 2 (unable to get issuer certificate)
The relevant part of my nginx.conf is as follows:
ssl on;
ssl_certificate /etc/ssl/certs/server_cert.pem;
ssl_certificate_key /etc/ssl/private/server_key.pem;
ssl_client_certificate /etc/ssl/certs/IntermediateCA_chain.crt;
ssl_crl /etc/ssl/crl.pem;
ssl_verify_client on;
The file IntermediateCA_chain.crt is in PEM-format, and consists of both the IntermediateCA's certificate and afterwards our RootCA's cert.
Side-note: when I do openssl x509 -text -noout -in IntermediateCA_chain.crt only the IntermediateCA's cert is shown. I expected the chain to be displayed. Is that the correct behaviour?
I test the connection with the following command:
openssl s_client -connect server:995 -cert mycert.pem\
-key mykeyfile.pem -debug -CAfile IntermediateCA_chain.pem
Resulting in
[...]
0b50 - b3 c3 3b 17 66 8e 52 b3-ad 7f 14 ..;.f.R....
depth=1 DC = top, DC = ad, CN = Intermediate CA
verify error:num=2:unable to get issuer certificate
issuer= C = DE, O = My Company, CN = My Companies Root CA, emailAddress = [email protected]
read from 0x10f6a10 [0x10fe333] (5 bytes => 5 (0x5))
[...]
I tried every variation of IntermediateCA_chain.pem I could think of (IntermediateCA.pem, RootCA.pem, IntermediateCA_chein.pem) on both sides.
It seems as though the failure is on the client-side, because it changes slightly with the used -CAfile and the server's logs show nothing (literaly nothing - no connection attempt or anything else). It seems to me as if either the IntermediateCA_chain.pem on the server- or the client-side are not read correctly. The error seems to result in openssl not beeing able to verify the IntermediateCA, and the certificates issued by it. Can someone help me solve this riddle?
|
Problem solved.
I'll post the reasons and the solution for the slight possibility that it might help someone else:
The first error (verify error:num=2:unable to get issuer certificate) resulted from the form of the -CAfile used on the client side. It was in x509 PEM format and contained a chain of the IntermediateCA's certificate by the RootCA's cert. The problem was that it also contained each CA's CRL (Certificate Revocation List), after its respective certificate-block. Removing them solved this error.
Afterwards I only got a non-descriptive "SSL-error" which I diagnosed by turning of individual options in the nginx.conf (thanks @mofoe for the tip!).
It turns out the ssl_crl inside the nginx.conf needs to contain not only the CRL of the IntermediateCA (in x509 PEM-format!), but also the Root-CA's CRL. Combining those two into one CRL-file solved the second error, and the server responded with the expected mailserver welcome-message.
| NginX client cert authentication fails with "unable to get issuer certificate" |
1,475,608,012,000 |
I sent an e-mail message from machine named syslog-server with command mail -s "syslog test" [email protected] <<< "test". The mail message was not delivered to receiver and following messages were logged to syslog-server log file:
Mar 11 13:16:06 syslog-server sendmail[30925]: u2BBG6mY030925: from=root, size=223, class=0, nrcpts=1, msgid=<201603111116.u2BBG6mY030925@syslog-server>, relay=root@localhost
Mar 11 13:16:06 syslog-server sm-mta[30931]: u2BBG6tO030931: from=<root@syslog-server>, size=461, class=0, nrcpts=1, msgid=<201603111116.u2BBG6mY030925@syslog-server>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Mar 11 13:16:07 syslog-server sendmail[30925]: u2BBG6mY030925: [email protected], ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30223, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (u2BBG6tO030931 Message accepted for delivery)
Mar 11 13:16:07 syslog-server sm-mta[30941]: STARTTLS=client, error: connect failed=-1, SSL_error=1, errno=0, retry=-1
Mar 11 13:16:07 syslog-server sm-mta[30941]: STARTTLS=client: 30941:error:14082174:SSL routines:SSL3_CHECK_CERT_AND_ALGORITHM:dh key too small:s3_clnt.c:3337:
Mar 11 13:16:07 syslog-server sm-mta[30941]: ruleset=tls_server, arg1=SOFTWARE, relay=mail.example.com, reject=403 4.7.0 TLS handshake failed.
Mar 11 13:16:09 syslog-server sm-mta[30941]: STARTTLS=client, relay=mail.example.org., version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-SHA, bits=256/256
Mar 11 13:16:09 syslog-server sm-mta[30941]: u2BBG6tO030931: to=<[email protected]>, ctladdr=<root@syslog-server> (0/0), delay=00:00:03, xdelay=00:00:02, mailer=esmtp, pri=120461, relay=mail.example.org. [192.0.2.34], dsn=5.1.8, stat=User unknown
Mar 11 13:16:09 syslog-server sm-mta[30941]: u2BBG6tO030931: u2BBG9tO030941: DSN: User unknown
Mar 11 13:16:09 syslog-server sm-mta[30941]: u2BBG9tO030941: to=<root@syslog-server>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30000, dsn=2.0.0, stat=Sent
As I am new to e-mail, could somebody explain me what happened here? As I understand, in third log line my e-mail message was accepted for delivery, then there were multiple (failed) attempts to send e-mail message over TLS, but then the e-mail was sent and remote MTA reported back that user(test) at example.net is unknown?
|
Log entries sets 1,2,3 are chained based on queueid.
Log entries set 4 is chained based on sendmail process id (pid).
Message is successfully passed to local main sendmail daemon at 127.0.0.1:25
QID=u2BBG6mY030925 (QUID_at_127.0.0.1=u2BBG6tO030931)
Mar 11 13:16:06 syslog-server sendmail[30925]: u2BBG6mY030925: from=root, size=223, class=0, nrcpts=1, msgid=<201603111116.u2BBG6mY030925@syslog-server>, relay=root@localhost
Mar 11 13:16:07 syslog-server sendmail[30925]: u2BBG6mY030925: [email protected], ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30223, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (u2BBG6tO030931 Message accepted for delivery)
Receiving server mail.example.org states that "recipient is unknown"
QID=u2BBG6tO030931 (QID_of_bounce=u2BBG9tO030941)
Mar 11 13:16:06 syslog-server sm-mta[30931]: u2BBG6tO030931: from=<root@syslog-server>, size=461, class=0, nrcpts=1, msgid=<201603111116.u2BBG6mY030925@syslog-server>, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Mar 11 13:16:09 syslog-server sm-mta[30941]: u2BBG6tO030931: [email protected], ctladdr=<root@syslog-server> (0/0), delay=00:00:03, xdelay=00:00:02, mailer=esmtp, pri=120461, relay=mail.example.org. [192.0.2.34], dsn=5.1.8, stat=User unknown
Mar 11 13:16:09 syslog-server sm-mta[30941]: u2BBG6tO030931: u2BBG9tO030941: DSN: User unknown
Bounce mail (report about delivery problems) is sent to sender
QID=u2BBG9tO030941 about delivery of u2BBG6tO030931
Mar 11 13:16:09 syslog-server sm-mta[30941]: u2BBG6tO030931: u2BBG9tO030941: DSN: User unknown
Mar 11 13:16:09 syslog-server sm-mta[30941]: u2BBG9tO030941: to=<root@syslog-server>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30000, dsn=2.0.0, stat=Sent
There were problems with STARTLS (switching to encrypted connection)
PID=30941
Mar 11 13:16:07 syslog-server sm-mta[30941]: STARTTLS=client, error: connect failed=-1, SSL_error=1, errno=0, retry=-1
Mar 11 13:16:07 syslog-server sm-mta[30941]: STARTTLS=client: 30941:error:14082174:SSL routines:SSL3_CHECK_CERT_AND_ALGORITHM:dh key too small:s3_clnt.c:3337:
Mar 11 13:16:07 syslog-server sm-mta[30941]: ruleset=tls_server, arg1=SOFTWARE, relay=mail.example.com, reject=403 4.7.0 TLS handshake failed.
Mar 11 13:16:09 syslog-server sm-mta[30941]: STARTTLS=client, relay=mail.example.org., version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-SHA, bits=256/256
Send as root a test message in verbose mode with SMTP session tracking to be 100% sure. STARTTLS problems and bad email domain used in sender address ("naked" host name) may lead to "misleading" log entries.
#!/bin/sh
/usr/sbin/sendmail -i -Am -v -- [email protected] <<END
Subject: test email subject
test email body
END
| understand sendmail log messages |
1,475,608,012,000 |
I am trying to migrate a number of user mail accounts from dovecot 1.0.7 on a centos 5.11 server to dovecot 2.1.7 on a debian 7 server
Foolishly I thought I could simply replicate the Maildirs from one server to the other using rsync, change the dns and all would be fine.
Sadly that did not work.
While the process did seem to go well Thunderbird on my test account is insisting on re downloading ALL the mail as duplicate unread emails.
Is there a way I can import the mail from the source centos server to the destination debian server without forcing the user to potentially having to sort through and delete hundreds of duplicate emails?
I am using IMAP for the mail protocol
|
I have solved the issue.
I have been meaning to do this move for a few months. in that time I have been rsyncing all users folders to the new server.
I forgot to add the --delete command to the rsync command thus old email messages were accumulating on the destination (new) server even after the user had deleted them from the old server.
Therefore when I switched to the new server dovecot automatically indexed the extra emails and the clients dutifully picked them up.
| Migrate mail from dovecot on centos to dovecot on debian |
1,475,608,012,000 |
I'm trying to forward the emails from my Debian server to my usual email address. I'm probably missing something important, as I can't find a good solution online looking for the following error message:
dnslookup defer (-1): host lookup did not complete
I found this answer but it did not help me:
https://serverfault.com/questions/370489/exim-cannot-send-to-remote-mail-servers
I have a user Debian-exim:
uid=101(Debian-exim) gid=103(Debian-exim) groups=103(Debian-exim)
I don't think that port 25 is filtered on my network. Anyway, I think that it is a DNS issue for now. I am not sure if the following server here is still working and can't find another address to test with:
telnet 209.85.225.27 25
Trying 209.85.225.27...
telnet: Unable to connect to remote host: Connection timed out
This works:
echo "This is a test." | mail -s Testing user@localhost
This does not:
echo "This is a test." | mail -s Testing [email protected]
echo "This is a test." | mail -s Testing [email protected]
In /var/log/exim4/mainlog I got:
1YDDm0-0007mZ-BS <= [email protected] U=user P=local S=464
1YDDm0-0007mZ-BS == [email protected] R=dnslookup defer (-1): host lookup did not complete
1YDE1X-0007v5-EG <= [email protected] U=user P=local S=456
And in /etc/resolv.conf:
domain home
search home
nameserver 192.168.1.1
And finally (The interesting part seems to be at the very end):
sudo exim -bt -d-resolver [email protected]
[sudo] password for user:
Exim version 4.80 uid=0 gid=0 pid=31872 D=fbb95cfd
Berkeley DB: Berkeley DB 5.1.29: (October 25, 2011)
Support for: crypteq iconv() IPv6 GnuTLS move_frozen_messages DKIM
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmjz dbmnz dnsdb dsearch nis nis0 passwd
Authenticators: cram_md5 plaintext
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore autoreply lmtp pipe smtp
Fixed never_users: 0
Size of off_t: 8
Compiler: GCC [4.6.3]
Library version: GnuTLS: Compile: 2.12.20
Runtime: 2.12.20
Library version: PCRE: Compile: 8.30
Runtime: 8.30 2012-02-04
Total 13 lookups
WHITELIST_D_MACROS: "OUTGOING"
TRUSTED_CONFIG_LIST: "/etc/exim4/trusted_configs"
changed uid/gid: forcing real = effective
uid=0 gid=0 pid=31872
auxiliary group list: <none>
seeking password data for user "uucp": cache not available
getpwnam() succeeded uid=10 gid=10
changed uid/gid: calling tls_validate_require_cipher
uid=101 gid=103 pid=31873
auxiliary group list: <none>
tls_validate_require_cipher child 31873 ended: status=0x0
configuration file is /var/lib/exim4/config.autogenerated
log selectors = 00000ffc 00612001
trusted user
admin user
seeking password data for user "mail": cache not available
getpwnam() succeeded uid=8 gid=8
user name "root" extracted from gecos field "root"
originator: uid=0 gid=0 login=root name=root
sender address = [email protected]
Address testing: uid=0 gid=103 euid=0 egid=103
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Testing [email protected]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Considering [email protected]
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
routing [email protected]
--------> hubbed_hosts router <--------
local_part=my domain=mail.eu
checking domains
expansion of "${if exists{/etc/exim4/hubbed_hosts}{partial-lsearch;/etc/exim4/hubbed_hosts}fail}" forced failure: assume not in this list
hubbed_hosts router skipped: domains mismatch
--------> dnslookup_relay_to_domains router <--------
local_part=my domain=mail.eu
checking domains
mail.eu in "@:localhost:example.dynu.com"? no (end of list)
mail.eu in "empty"? no (end of list)
mail.eu in "! +local_domains : +relay_to_domains"? no (end of list)
dnslookup_relay_to_domains router skipped: domains mismatch
--------> dnslookup router <--------
local_part=my domain=mail.eu
checking domains
cached no match for +local_domains
cached lookup data = NULL
mail.eu in "! +local_domains"? yes (end of list)
R: dnslookup for [email protected]
calling dnslookup router
dnslookup router called for [email protected]
domain = mail.eu
DNS lookup of mail.eu (MX) gave TRY_AGAIN
mail.eu in dns_again_means_nonexist? no (option unset)
returning DNS_AGAIN
dnslookup router: defer for [email protected]
message: host lookup did not complete
[email protected] cannot be resolved at this time: host lookup did not complete
search_tidyup called
>>>>>>>>>>>>>>>> Exim pid=31872 terminating with rc=1 >>>>>>>>>>>>>>>>
Could someone help me out here?
Thanks a lot!
|
The standard dnslookup router of exim uses an algorithm to decide how to resolve an email address (this is detailed in the Exim manual on the chapter detailing dnslookup router). Looking at the results from dig, this seems fine:
$ dig mail.eu mx
; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> mail.eu mx
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5467
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 4
;; QUESTION SECTION:
;mail.eu. IN MX
;; ANSWER SECTION:
mail.eu. 86400 IN MX 10 in1-smtp.messagingengine.com.
mail.eu. 86400 IN MX 20 in2-smtp.messagingengine.com.
;; ADDITIONAL SECTION:
in1-smtp.messagingengine.com. 72474 IN A 66.111.4.70
in1-smtp.messagingengine.com. 72474 IN A 66.111.4.73
in1-smtp.messagingengine.com. 72474 IN A 66.111.4.72
in1-smtp.messagingengine.com. 72474 IN A 66.111.4.71
;; Query time: 33 msec
;; SERVER: 192.168.0.1#53(192.168.0.1)
;; WHEN: Mon Jan 19 16:51:24 2015
;; MSG SIZE rcvd: 158
This means that your local resolver (192.168.1.1) is either returning a TRY_AGAIN response for the SRV request (have you got SRV enabled in your exim configuration) OR has "negatively cached" a failed result (was your DSL down at the time it happened?).
I would suggest testing around your resolver by using an open DNS server (such as Google's), by adding:
nameserver 8.8.8.8
before your
nameserver 192.168.1.1
statement in your resolv.conf and then try running you exim -bt [email protected] test again to rule out this resolvers response.
If using Google's DNS cache server solves the issue, then a restart of your DNS resolver (the device at 192.168.1.1) to see if that solves the ongoing issue (don't forget to comment out the Google cache entry before re-testing!)
There are other options detailed in that chapter if you continue to get errors even when using Google's DNS cache servers (or if you prefer NOT to use an external DNS resolver). Note that by adding the nameserver line all DNS lookups will be passed to Google for resolving. This will add a small delay to DNS requests as well as passing on all DNS requests your host will make to Google - not everyone's idea of a "Good Thing"™.
| Exim4 DNS issues |
1,475,608,012,000 |
Is there currently a Linux email server that will allow me to replicate how Gmail or Outlook allow aliases.
i.e. with Hotmail (which is now Outlook) or Gmail I can sign up on a site and use [email protected] and it will come to the [email protected] account without first having to set up an alias.
|
This is typically called “plus addressing”. Most email servers can do it and were already doing it before GMail and Hotmail existed and copied that feature.
With Postfix, set recipient_delimiter in /etc/postfix/main.cf. This is in the default configuration as shipped by some distributions such as Debian and Ubuntu.
recipient_delimiter = +
With Exim, set a local part in /etc/exim.conf:
local_part_suffix = +* : -*
local_part_suffix_optional
The old Email addressing FAQ discusses some older MTAs including Sendmail and Qmail.
| Email server with automatic + sign aliases? |
1,475,608,012,000 |
Today while setting up a mail server using postfix, I practiced to use sender_canonical_maps option, and noticed that it can change outgoing mail "sender" to appear like someone else. When Gmail picked up the mail, it showed the fake sender as the origin.
If mail sender can be easily faked, as an Email end-user, how do I distinguish between fake sender and real sender?
|
For starters, changing the sending mail address is not necessarily "faking". You may simply change the address from one address that is yours to another that is also yours.
But, to answer your question - neither SMTP nor the message format gives you that possibility. Pretty much every piece of spam mail that you get has both an envelope sender and a From:-header that has nothing to do with who actually sent the mail.
Some email providers, e.g. gmail, will do their best to verify that you are not using a From:-header that does not belong to you. But even when they do that, if someone else can get at your gmail account, they will also be able to send mail using those headers, even though they are not you. It's also possible to verify that the domain name in the envelope sender address matches the server from which the mail was sent, by using e.g. DKIM. But it's far from universally adopted.
The way to certify a sender is to use e.g. GPG to sign the message cryptographically.
| How to identify faked mail origin? |
1,475,608,012,000 |
I'm trying to send email with an html file as the body (it's actually a cucumber results report if that matters) or an attachment (if sending it as the body does not work) via the command line
I've tried the following based on the mutt example in this answer to another question, but it is resulting in an error.
cat <<'EOF' Audit_Results.html | mutt -H -
To: [email protected]
Subject: "test sending html mail"
Content-Type: text/html
EOF
when I do this I get the following error
No recipients were specified.
Mutt was installed using brew install mutt and it looks like that installed version 1.5.21. I am able to send mail via the 'interactive' interface but just tested that with simple text mail, nothing html or with an attachment.
My objective is to send the cucumber results file "Audit_Results.html" file out as an email. Although the file includes some screenshots that are created using webdriver's .screenshot_as(:base64) method, and embedded using cucumber's embed("data:image/png;base64,#{encoded_img}",'image/png') function which seems to pose a bit of a problem. So far the one time I've managed to create a html mail from the report (using sendmail) it did not display properly in gmail. (although if sent as an attachment, it will format properly when downloaded and opened with a browser) Seems like gmail at least does not like html email with images embedded in that format. So it may be that I will end up needing to send the html report as an attachment.
|
If you just want to send Audit_Results.html verbatim, use this syntax:
mutt -e "set content_type=text/html" -s "Your audit results" [email protected] < Audit_Results.html
You won't need to pre-edit Audit_Results.html with mail headers, you can just send it directly.
| Trying to send HTML mail on mac OSX Mountain Lion |
1,475,608,012,000 |
I have a cPanel web hosting account. On this account I have a PHP-based support/trouble ticket system for my customers to use. I'd like to be able to send an email to both my customer and to the ticket system, but have the email that goes to the ticketing system appear to come from my customer, so that the support ticket which gets created appears under their account.
So what I want to do is create some email address [email protected] which gets piped to a unix command or shell script. This means that when I send an email from [email protected] to [email protected] and CC [email protected], the shell script should be able to resend the email to [email protected] but resend the email from the To: address of the email.
Is there any way to make a shell script which will accept an email on stdin, rewrite the From: address, and resend the mail to a new address? Can Procmail do anything like that? Or will I have to hand code this myself?
|
Procmail comes with the formail command to manipulate mail headers. The procmailex contains examples of uses in .procmailrc. This should do what you want (untested):
formail -R To: From: -U From: -I Cc: -I 'To: [email protected]'
| How can I rewrite the From: address of an email and resend it? |
1,475,608,012,000 |
While I can find some scattered info on the topic, I can't seem to find a straight walkthrough (or even a definite answer)...
Basically I'm too low on the totem pole to start sending plain-text e-mails. My company requires an HTML signature that includes the logo image.
The problem is I'm fed up with GUI mail clients. Is it possible to configure Mutt in a way that would allow me to have all messages I write injected to an HTML template (with an embedded image)? Or will I just have to deal with Thunderbird's chaos?
Thanks for any help!
|
This is a huge hack, but somebody has already done the work for you.
Edit: What if you attached your signature as an HTML file?
mutt -e "set content_type=text/html" [email protected] -s "Hello" < mysig.html
| Sending HTML with Mutt (or another terminal mail client) |
1,475,608,012,000 |
I'm using the following very basic shell script I copied off the net to list the contents of my database backup folder and mail them regularly:
MYSQLLIST=$(ls -lhG /var/backups/mysql/daily/)
SUBJECT="daily backup finished"
EMAIL="logging@localhost"
EMAILMESSAGE="/tmp/emailmessage.txt"
echo "dailybackup.sh ran successfully" > $EMAILMESSAGE
echo "MYSQL:" >> $EMAILMESSAGE
echo $MYSQLLIST >> $EMAILMESSAGE
mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
However - regardless the mail reader - in the mail I receive there are no line breaks between the rows of the ls output, which makes the message terribly hard to read. How could I produce line breaks identical to those I get when executing ls -lhG on the shell?
|
Try dropping the command sutstitution that stuffs a variable and then echos it back and just redirect the output of ls straight to the message file.
SUBJECT="daily backup finished"
EMAIL="logging@localhost"
EMAILMESSAGE="/tmp/emailmessage.txt"
echo "dailybackup.sh ran successfully" > $EMAILMESSAGE
echo "MYSQL:" >> $EMAILMESSAGE
ls -lhG /var/backups/mysql/daily/ >> $EMAILMESSAGE
mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
Edit: You could further clean up this script with exactly the same result like this:
(
echo "dailybackup.sh ran successfully"
echo "MYSQL:"
ls -lhG /var/backups/mysql/daily/
) | mail -s "Daily backup finished" "logging@localhost"
This runs a few commands in a subshell and then directs the entire output from the subshell straight into mail without the fuss of writing a temporary file.
| Enable line breaks when assigning multi line outputs to var in bash |
1,475,608,012,000 |
I am a longtime mutt user (actually switched to neomutt) some time ago and there is one thing I never quite managed to configure to my liking:
I have several accounts that I map to several folders.
I adjust my IMAP/SMTP credentials as well as mailboxes etc. via folder and account hooks.
Since I also use sidebar, I can easily switch from one mail account to the next.
I also adjust the 'From:' header via a folder hook, such that when sending an email, my name and email are chosen automatically to match the account I am sending from.
If I want to reply to an email that was send to account A from account B, I usually copy/move the message from folder/server A to folder/server B, switch folders/accounts (letting those hooks do their thing) and reply from there. That is a bit cumbersome but happens rare enough so I do not really care.
However, I also happen to have two accounts/mailboxes that receive mail sent to several email-adresses (think [email protected], [email protected], [email protected]). I can send email from all of those by manually adjusting the 'From:' field when composing an email.
However, I would like this to happen automatically when replying to an email: If I reply to an email that was sent to [email protected], I do not want to reply from [email protected], even though this might be my preferred default configured via the my-domain folder/account hooks.
This answer suggests set reverse_name=yes to do just that (if I understood correctly) but adding that to my .neomuttrc didn't have the desired effect. I suspected the hook setting From: might override that setting and commented it out for testing, but now I simply compose/reply from my-local-user@hostname.
I am aware of but not interested in mutt-vid since it is way overkill for my simple needs: I am fine with manually setting my sender's address when starting a new email thread (in case I am not happy with the default configured through my hooks). So there is no need to learn the most likely most appopriate sender's address based on the recipient and past interaction. I just don't want have to remember to manually change my sender's address if I reply to an email I receive via a non-default address.
|
I also receive emails at multiple addresses (I create a new one for each online organisation I have to create an account with). Setting the reverse_name option works as expected for me – but that’s because I have the alternate addresses configured with a regular expression which matches all my email addresses – and I haven’t started using hooks (yet):
# When replying to an email, use the To: address of the original email as the
# From: address in the reply (requires that the To: address be recognised by
# Mutt as being one of my alternate addresses).
set reverse_name
# Let Mutt know what other email addresses are used by me.
alternates ^[email protected]$ @example
# I had been thinking of writing a script to dynamically create a file of
# alternative addresses from /etc/aliases but there’s no need to list them
# individually as – currently – all example.ie and example.info addresses
# are me so it is enough to just match the `@example` regular expression.
You might find it useful to also use the edit_headers option which allows the From address to be set manually in your text editor when composing a message:
# When composing a message, edit the headers along with the message body.
# This should make it easier to see that the correct From address is being used
# and to fix this if necessary.
set edit_headers
| (neo)mutt: Reply to email from the adress the original message was sent to (auto-adjust sender / from-address)? |
1,475,608,012,000 |
I have a situation where I need to delete from mailbox (eg. /var/mail/root) messages with specific Message-Id.
Following code works only from console, but I have to do it without user interaction running from cron /etc/crontab.
File: /tmp/clear_spam_test
mutt -f /var/mail/root -e "set alias_file=/var/mail/root" -e "set crypt_use_gpgme=no" -e "push <delete-pattern>[email protected]\n<sync-mailbox>qy"
I tried many variations
ssh -tt localhost 'bash -s' < /tmp/clear_spam_test
Output:
mutt -f /var/mail/root -e "set alias_file=/var/mail/root" -e "set crypt_use_gpgme=no" -e "push <delete-pattern\>[email protected]\n\<sync-mailbox\>qy"
echo -e "\nTEST $( whoami ) $0"
exit 0
<n>[email protected]\n<sync-mailbox>qy"
Error opening terminal: unknown.
TEST root bash
exit
Connection to localhost closed.
ssh -t localhost 'bash -s' < /tmp/clear_spam_test
Output:
Pseudo-terminal will not be allocated because stdin is not a terminal.
No recipients were specified.
ssh -T localhost 'bash -s' < /tmp/clear_spam_test
Output:
No recipients were specified.
ssh -tt $server <<'ENDSSH'
echo $(/tmp/clear_spam_test)
exit 0
ENDSSH
Output:
Error opening terminal: unknown.
TEST root /tmp/clear_spam_test
logout
Connection to localhost closed.
ssh -t $server <<'ENDSSH'
echo $(/tmp/clear_spam_test)
exit 0
ENDSSH
Output:
Pseudo-terminal will not be allocated because stdin is not a terminal.
mesg: ttyname failed: Inappropriate ioctl for device
No recipients were specified.
TEST root /tmp/clear_spam_test
ssh -T $server <<'ENDSSH'
echo $(/tmp/clear_spam_test)
exit 0
ENDSSH
Output:
mesg: ttyname failed: Inappropriate ioctl for device
No recipients were specified.
TEST root /tmp/clear_spam_test
None of it works. I also tried IFS.
|
Same problem here. This mutt command seems to depend on a working terminal window that cron cannot build.
At least for me it helped to start a virtual terminal using screen:
screen -d -m mutt -f /var/mail/root -e "set alias_file=/var/mail/root" -e "set crypt_use_gpgme=no" -e "push <delete-pattern>[email protected]\n<sync-mailbox>qy"
| CRON (no tty): Delete message with specific "Message-Id" |
1,475,608,012,000 |
On my development machine, I have a special kind of SMTP server running on non-standard port which is used for testing purposes.
On my virtual machine I'm trying to push a message to that SMTP server by using Exim4's sendmail app:
selenium-node$ sendmail -t
To: [email protected]:2525
From: [email protected]
Subject: Test message
Quick brown fox jumps over the lazy dog
selenium-node$
However, it looks that default SMTP server on my-development-machine.testingnetwork.local:25 receives my message instead.
Is there a clean and natural way to do what I'm trying for? Modifying some configs on my-selenium-node.testingnetwork.local is no problem.
|
SMTP always goes to TCP/25 unless the mail delivery agent (here, sendmail as implemented by Exim) is specifically configured to send the mail to some custom port. There is no means to set the port like there is in URL from the mail user agent that talks to the mail delivery agent. Options thus are limited to reconfiguring Exim to send to a different port or to use some other mail sending program to direct the mail elsewhere, such as ssmtp with configuration in ssmtp.conf along the lines of
mailhub=my-development-machine.testingnetwork.local:2525
and then piping the message to ssmtp. Another option would be to use a SMTP client module in some programming language; these may support sending to arbitrary TCP ports.
| Dealing with non-standard SMTP ports with sendmail -t |
1,475,608,012,000 |
How do I send a mail thanks to swaks with BCC recipients?
|
it easy:
swaks --to email1,email3 --from email2 --server smtp --auth LOGIN --auth-user "" --auth-password "" --header "Subject: test" --data "Subject: test
To: email1
Bcc: email3
From: email2
MIME-VERSION: 1.0
Content-Type: multipart/mixed; boundary=\"123456789\"
--123456789
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<html>
</html>
| How to send mails with given bcc field with swaks? |
1,483,525,455,000 |
Is there any way to print/predict the Message-ID that mutt will assign to the mail currently being composed?
It looks like it consists of a timestamp, a random string (is it?) and the hostname from muttrc, but it's unclear when this is generated.
|
The message identifier is generated if necessary when the envelope is prepared, i.e. just before mutt sends the email. There doesn't seem to be a way of seeing the generated identifier within mutt before the message is sent. If you manually specify your own identifier in the composed message, mutt will use that...
The generated identifier itself contains the following information (see mutt_gen_msgid() in sendlib.c), as of the current development tip:
year;
month;
day in month;
hour;
minute;
second;
a single character between 'A' and 'Z';
mutt's process identifier;
the host's FQDN.
In the version I currently have on Debian though there is indeed a random string (instead of the single character and process identifier).
In any case the identifier isn't predictable accurately!
| Show Message-ID for mail being written |
1,483,525,455,000 |
I transferred my email setup to a new laptop, and fetchmail stopped fetching my mail. From what I can tell in the fetchmail log, it authorizes fine, sees that new emails are there, tries to fetch them, and fails due to a persistent "Temporary lookup failure" - here's the relevant log bit:
fetchmail: 2134 messages (2130 seen) for recent:patena at pop.gmail.com (397667985 octets).
fetchmail: POP3> LIST 2123
fetchmail: POP3< +OK 2123 679
fetchmail: POP3> RETR 2123
fetchmail: POP3< +OK message follows
fetchmail: reading message recent:[email protected]:2123 of 2138 (679 octets)Trying to connect to 127.0.0.1/25... connected.
fetchmail: SMTP< 220 bleen.gateway.2wire.net ESMTP Postfix (Ubuntu)
fetchmail: SMTP> EHLO bleen
fetchmail: SMTP< 250-bleen.gateway.2wire.net
fetchmail: SMTP< 250-PIPELINING
fetchmail: SMTP< 250-SIZE 307200000
fetchmail: SMTP< 250-VRFY
fetchmail: SMTP< 250-ETRN
fetchmail: SMTP< 250-STARTTLS
fetchmail: SMTP< 250-ENHANCEDSTATUSCODES
fetchmail: SMTP< 250-8BITMIME
fetchmail: SMTP< 250 DSN
fetchmail: SMTP> MAIL FROM:<[email protected]> SIZE=679
fetchmail: SMTP< 250 2.1.0 Ok
fetchmail: SMTP> RCPT TO:<weronika@localhost>
fetchmail: SMTP< 451 4.3.0 <weronika@localhost>: Temporary lookup failure
fetchmail: SMTP error: 451 4.3.0 <weronika@localhost>: Temporary lookup failure
fetchmail: SMTP> RSET
fetchmail: SMTP< 250 2.0.0 Ok
fetchmail: not flushed
fetchmail: POP3> LIST 2124
(And so on from "LIST" to "not flushed" for each unseen message.)
It's been going on for most of a day, so this temporary lookup failure doesn't seem very temporary.
|
The fetchmail: SMTP ... logs indicate that fetchmail is talking to a Mail Transport Agent (MTA), here Postfix, and Postfix has rejected the message from fetchmail on account of not being able to resolve the (unqualified!) hostname of localhost. Thus, the solution is to correct the DNS (and possibly hostname) for the system. This may also make sending mail from the system easier, as many mail servers will reject mail from hosts with unqualified names as an anti-spam measure.
An alternative would be to configure fetchmail via the mda setting to instead deliver directly to a program such as maildrop, thus cutting the local MTA out of the delivery loop.
| fetchmail sees mail but doesn't fetch it - persistent "temporary lookup failure" |
1,483,525,455,000 |
I am using OSX 10.9.5
Whenever I open a terminal, it says something like:
Last login: Wed Jan 21 10:29:13 on ttys002
You have mail.
What mail is it talking about ? If I open the mail app, I have no new mail. This is a laptop, and I have not setup a mail server, so how do I find out why it is reporting I have mail ? And how do I get rid of the message ?
|
Well, you probably have mail. ;)
It talks about your local inbox. Use mail or mutt or from to see your local mails. I'm not sure what mail client is installed per default on OSX, but I would expect to find mail on pretty much any unix system.
OSX, at the end, is just another unix and unix is designed to be a multi-user system, i.e. multiple different persons can use the same system at the same time. - In the time unix was designed it was common to have one big server and people were using a terminal for logging in remotely.
Therefore they should be able to communicate with each other. - One way is using mail. You can send someone locally a mail by typing mail otheruser and read your own mail by typing mail.
Even if you are the only user on your computer, system daemons might send you some mails to inform you about what is going on. (They can be configured what to send.)
| Why does terminal say I have mail every time I open it? |
1,483,525,455,000 |
If postfix is setup as the MTA using its virtual transport to deliver mail to a local mbox file (and handling delivery of outgoing messages), and mailx is the MUA, being used on that same computer for reading and composing messages, can only one of these operations happen at once due to mbox file locking?
If a user is using mailx to read their messages and perhaps reply to or compose a few messages, does this prevent postfix from delivering new messages to the user's mbox file? Does this create a situation where the user might not receive some messages due to the incoming messages being bounced?
What is the process for mbox file locking here? When and where is it happening? I am trying to get a better idea of how this works.
|
You are right, Postfix will lock the mail file during delivery.
The mailbox is locked for exclusive access while delivery is in progress.
Read more about it here
But that doesnt mean that your other incoming mails will bounce. If postfix cant deliver during a try,
Apr 15 14:02:25 server.tld postfix/local[67533]: D8C46C9014D: to=, relay=local, delay=1956, delays=1936/0.01/0/20, dsn=4.2.0, status=deferred (cannot update mailbox /var/spool/mail/user for user user. unable to create lock file /var/spool/mail/user.lock: File exists)
it will keep your mail in deferred queue and retry it later until maximal_queue_lifetime expires. The default maximal_queue_lifetime value is 5 days
| How do postfix and mailx interact with mbox locking? |
1,483,525,455,000 |
I am using postfix with maildir format. The filenames of messages stored in maildir look something like this:
1386021659.27745_1.alpha:2,S
I understand the first part is epoch time, not sure about the rest. But I would like to have some human friendlier name, such as
2013-12-18__120502.sender_or_subject_of_the_message:2,S
I need to manipulate the individual messages/files often (this is the reason why I am using maildir in the first place). Having some more descriptive filename would help.
Can I set this in postfix?
|
No, Postfix has no way to configure this. As @HBruijn said, the Maildir format is a specification and it would be quite an effort to make the LDA and the MUA both agree on a different format. That said, if you don't like the filenames in your maildir, you could beautify them a bit when you look them up:
$ ls | head -1
1325471944.27745_1.beta,S=10662:2,S
$ ls | head -1 | perl -pe 's/(\d+)/localtime($1)/e'
Mon Jan 2 03:39:04 2012.27745_1.beta,S=10662:2,S
| postfix: different file name format for Maildir messages |
1,483,525,455,000 |
When extracting a message from my inbox containing the norwegian letter "ø" I find that it is encoded with 3 bytes as "=F8" or hexadecimal "0x3d4638". In UTF-8 the letter "ø" is encoded with two bytes as "0xc3b8", whereas in ISO-8859-1 it is encoded as one byte with code "0xf8".
What kind of encoding is used by my mail server when it saves incoming mail? That is, in which encoding is "ø" equal to "0x3d4638"?
|
It is called quoted-printable.
I take the opportunity to link to another doc worth reading about character encodings: http://utf8everywhere.org/ [of course, not possible in emails, and that's why they use other types of encoding there... But still, good to read when you are about to choose which encoding to use!]
| Mail character set for norwegian characters |
1,483,525,455,000 |
I am running postfix, and it seems it is willing to accept emails for system users, such as man, sshd, daemon, www-data, ...
Is desirable (probably not)? and what I can do to disable this?
|
Any user can potentially run cron jobs. The man user might purge the catman cache. The bin user might do library and package management. The www-data user might purge caches. If any of these cron jobs give output (often to indicate a problem) it is nice to let someone know, and cron does this by default by mailing the running user.
Now the simple thing to do is to alias all these users to root and alias root to a real user who is responsible for dealing with all this (martin). Simple, effective, and does not require things like maintaining multiple user databases (email users, login users, psudo users) and the complicated configuration that requires.
| Restrict emails to system users in postfix? |
1,483,525,455,000 |
I am successfully performing some very basic SMTP sending in my machine with a basic Python script:
.... things ...
try:
smtpObj = smtplib.SMTP('localhost')
smtpObj.sendmail(sender, recievers, message.format(now, now))
print "Successfully sent email"
except SMTPException:
print "Error: unable to send email"
It works fine both in my machine and in a Ubuntu server I have in Virtual Box. Now I would like to send one email from one server using the other server as a host.
I tried in my virtual host to change
smtpObj = smtplib.SMTP('localhost')
with
smtpObj = smtplib.SMTP('IP of my PC') #IP get from "ifconfig -a"
but does not work.
Am I missing something?
|
It works fine both in my machine and in a Ubuntu server I have in
Virtual Box. Now I would like to send one email from one server using
the other server as a host.
As you mentioned it's working in both machine with localhost not with IP address of host then, might be mail server is running only on localhost, So you need to Bind Postfix Mail Server To all or specific IP Address to interfaces.
Postfix IP address bind configuration:
Open /etc/postfix/main.cf file
Append / modify line as follows to bind to localhost (127.0.0.1) only:
inet_interfaces = NEW_IP_ADDRESS,127.0.0.1
Save and close the file. You need to stop and start Postfix when this parameter changes. So type the following to restart Postfix:
/etc/init.d/postfix restart
If you are using sendmail:
Open /etc/mail/sendmail.cf
Find the line starting with DaemonPortOptions and then replace Addr=127.0.0.1 to Addr=0.0.0.0
Note: 0.0.0.0 means all active interfaces.
then restart sendmail and Verify that everything is working fine:
netstat -tulpn | grep 25
tail -f /var/log/maillog
| sendmail through virtual machine |
1,483,525,455,000 |
Emails are now sent from www@hostname, but I want them to be sent from [email protected]
My developer said it should be in php.ini but I figured out this is true only for Win32 systems.
How do I make this change in FreeBSD 8.3-RELEASE-p3?
|
If you use the default mailserver (sendmail), you should add the -f argument to the sendmail_path in php.ini
| How do I change emails from: address on FreeBSD? |
1,483,525,455,000 |
CentOS 5.x
SendMail 8.14.4
An overzealous network security feature is causing TLS negotiations to fail when my Sendmail server tries to talk to external hosts. This is causing sendmail to constantly requeue some messages because it won't fail over to unencrypted delivery.
Is there a way to disable outbound TLS completely? I'm aware that I can add Try_TLS:broken.server NO entries for the individual mx records (or partial domains) but I'd prefer to just disable this entirely until the root cause gets resolved.
As far as I can tell, there doesn't appear to be any way to tell SendMail to not use TLS whatsoever.
I tried Try_TLS:* but that didn't work.
I understand that the root cause is not my specific system but as I don't have control of the affected parts, I'd like to at least get mail flowing. Any ideas?
|
I am not sure, but a quick search turned up this which says (emphasis mine):
To be able to send to (or receive from) those MTAs, the ruleset
try_tls (srv_features) can be used that work together with the access
map. Entries for the access map must be tagged with Try_TLS
(Srv_Features) and refer to the hostname or IP address of the
connecting system. A default case can be specified by using just the
tag.
| Is there a way to completely disable outbound opportunistic TLS support in SendMail? |
1,483,525,455,000 |
I'm running a MediaWiki install under Ubuntu Server 10.10. I have configured it to use the standard php mail() function with my local mail delivery agent (postfix). The mail gets sent from the MediaWiki site, but the only problem is that whenever the address it's meant to be sent to is on the same domain as the server, those mails get delivered to local inboxes on the Ubuntu server.
So basically, the server is linuxbox.companydomain.com, and our e-mails are [email protected]. Any mail sent to an address like that simply ends up in the user's local inbox, e.g. a message to [email protected] ends up in /home/anders/mbox, while a message to [email protected] would end up in the correct gmail inbox.
How do I prevent this from happening?
|
Mails to [email protected] end up in a local inbox because Postfix is configured to use local(8) delivery for the companydomain.com domain. Most likely this happens because companydomain.com is listed in the mydestination parameter, either explicitly or implicitly (because for example myhostname is companydomain.com and mydestination is at its default value which includes $myhostname).
So try setting mydestination=. If that doesn't help, edit your question and post output of the following commands to give more information on your setup:
postconf -n
postconf mydestination
postconf myhostname
| Mail send to my domain ends up in local inbox instead of exchange server |
1,483,525,455,000 |
I am in charge of maintaining a linux e-mail server running qmail on Red Hat Linux.
Fairly often, I have to trace the path of some email through syslog and to be frank, this is rather tedious.
Are there any desktop apps (or even command tools) that inspect the incoming and outgoing mail logs with better usability instead of clobbering bash commands together?
What I have in mind is some tool that I could import a log file and it would organize all the information for me, so that I could perform some searches on it, or view the path of email messages in and out of my system.
Perhaps this is lofty wishes at the moment, but I'm trying to see what my options are.
|
Have a look at Splunk. You can download a version for free -- at least to dig into a couple log files for you. It will help you manage your log files and also know whats going on in your system. It's quick to setup.
| Drudging through email logs |
1,483,525,455,000 |
Background
An email relaying issue was resolved.
32 email messages to sponsors had bounced to root.
I copied /var/mail/root to /tmp/root.
I deleted irrelevant messages from /tmp/root (using mutt).
All the bounced messages had the same sender.
Requirements
An efficient way to do the following for all 32 messages:
Extract the original message from the bounce message.
Send the message as the original sender to the original recipients, including the original bcc.
Make the sponsors notice nothing except that there was a delay in delivery.
|
In mutt, start in the message index listing the bounce notification messages of interest.
With the cursor on a bounce notification message, type v to open the Attachment Menu for the bounce notification message.
The Attachment Menu lists all attachments. A description of each attachment is shown. The subject of the original message is its description.
Press j to move the cursor to the attachment identified by its description as the original message. Do not open the attachment.
Press Escape-e to start the resend-message dialog.
The body of the original message opens in the mutt editor.
Press : to open the editor command line.
Press q and Enter to exit message composition.
Press y to resend the message.
Press q to return to the message index.
Use j or other appropriate keys to move the cursor to another bounce notification of interest.
As needed, go back to #2.
| How to resend bounced email messages using mutt |
1,483,525,455,000 |
My email provider operates a Microsoft Exchange server through which I send and receive email, using Thunderbird (on Ubuntu 20.04 LTS). I do this both on a desktop computer and on a separate laptop.
Everything works alright, except for the synchronization of message tags. If I tag an email in Thunderbird on the desktop using the '1' key, then this tag does not show up on the laptop and vice versa. Fortunately, this kind of tag synchronization does work on other email accounts that I have.
So:
Is there a way to get tag synchronization to work through a Microsoft Exchange server? (Assuming that using another email provider is not an option.)
|
I have found that Davmail works well for me.
(Davmail provides a POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange and Office 365 Gateway.) I've been using it for quite a number of years, most recently with Amazon Corretto as the Java runtime. There are times when the Exchange IMAP interface just doesn't work properly - and this is one of them.
| Email tag synchronization through Microsoft Exchange server |
1,483,525,455,000 |
I am trying to switch away from thunderbird into Neomutt but I need some ability to see the contents of emails without manually opening a pager. I receive way too many emails that are extremely short or don't have useful subjects Either showing the body next to the subject in the Index (like Gmail) or opening a pager on whichever message is currently highlighted (like Thunderbird) would work although I'd definitely prefer the former.
|
You cannot display body content in the index as it's in GMail. But you can easily navigate between messages using any of following solutions.
I assume you use default bindings, but I'll cite the function names in italic also. Both solutions relies on using built-in pager.
Solution #1 unset pager_stop
set pager_stop = no
pager_stop documentation
<enter> to display-message in pager, then pressing <space> next-page will take you to the next message when you reach the end of the current one. On short messages where there's not an option to scroll it acts on the first space hit.
Solution #2 set pager_index_lines
Keep index visible with $pager_index_lines number of lines when you display a message in pager.
set pager_index_lines = 10 # set to whatever you like
pager_index_lines documentation
With this settings You can <enter> to display-message and use j next-entry and k previous-entry to select messages in the index.
see both solutions in action:
| Neomutt Show Email Body as preview |
1,483,525,455,000 |
postsuper -d ALL
will delete all mails that are still in the postqueue without sending them again.
But what exactly is happening on the filesystem when you call this command?
I have a snapshot of a mail-system with postfix. Now I want to run the snapshot but do not want to send out remaining mails from the postqueue.
I would like to manually empty the postqueue in the locally mounted VM-image before I start it as a running server. The easiest way would be just to delete all files in the postqueue, so what does postsuper -d ALL do exactly?
Update:
A more complex solution would be to chroot into the mounted system:
mkdir /media/tmp/
mount /dev/vg0/vm01.tmp-disk-snapshot /media/tmp/
mount -t proc none /media/tmp/proc
mount --bind /dev /media/tmp/dev
mount -t sysfs sysfs /media/tmp/sys
chroot /media/tmp/ /bin/bash
Empty the postqueue so no mails are sent from your test VM and exit
postsuper -d ALL
exit
|
TLDR The postsuper -d ALL command deletes all the queued message files, in postfix queueing directories under /var/spool/postfix/.
Long answer:
As an example, having in the postfix queue 3 messages:
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
8EDC660C92* 400 Sun May 10 13:42:22 [email protected]
[email protected]
7334B60C89 395 Sun May 10 13:37:59 [email protected]
(connect to mx.ptmail.sapo.pt[212.55.154.36]:25: Connection timed out)
[email protected]
4BD3A60C8D 407 Sun May 10 13:38:18 [email protected]
(connect to alt4.gmail-smtp-in.l.google.com[74.125.28.26]:25: Connection timed out)
[email protected]
-- 1 Kbytes in 3 Requests.
Monitoring sudo postsuper -d ALL, for deleted files:
30305 13:42:28.160381720 0 postsuper (1091) < unlink res=0 path=defer/7/7334B60C89(/var/spool/postfix/defer/7/7334B60C89)
30329 13:42:28.160423699 0 postsuper (1091) < unlink res=0 path=defer/4/4BD3A60C8D(/var/spool/postfix/defer/4/4BD3A60C8D)
30379 13:42:28.160481785 0 postsuper (1091) < unlink res=0 path=active/8EDC660C92(/var/spool/postfix/active/8EDC660C92)
30419 13:42:28.160537670 0 postsuper (1091) < unlink res=0 path=deferred/7/7334B60C89(/var/spool/postfix/deferred/7/7334B60C89)
30443 13:42:28.160574946 0 postsuper (1091) < unlink res=0 path=deferred/4/4BD3A60C8D(/var/spool/postfix/deferred/4/4BD3A60C8D)
Actually, just found out in the postsuper source code, the option -v (verbose), shows the file operations.
So, running postfix -vd ALL, for the above queue(s), has as output:
postsuper: name_mask: all
postsuper: inet_addr_local: configured 2 IPv4 addresses
postsuper: queue: defer
postsuper: removed file defer/7/7334B60C89
postsuper: removed file defer/4/4BD3A60C8D
postsuper: queue: bounce
postsuper: queue: maildrop
postsuper: queue: incoming
postsuper: queue: active
postsuper: removed file active/8EDC660C92
postsuper: queue: deferred
postsuper: removed file deferred/7/7334B60C89
postsuper: removed file deferred/4/4BD3A60C8D
postsuper: queue: hold
postsuper: queue: flush
In practice, monitoring visited directories by the command, and in what concerns the filesystem, a postfix -d ALL is equivalent to:
sudo find /var/spool/postfix/{defer,bounce,maildrop,incoming,active,deferred,hold,flush} -type f -exec rm {} \;
This last command, applied to your example case of a mounted file system, would be:
sudo find /media/tmp/var/spool/postfix/{defer,bounce,maildrop,incoming,active,deferred,hold,flush} -type f -exec rm {} \;
Nevertheless, postsuper -d ALL operates directly in directories and files, i.e in the filesystem - it does not need the postfixservice to be up and running for clearing the queue(s). One alternative to deleting files directly, is booting the server in single mode and/or with the postfix service not running, and letting postsuper -d ALL do its job.
PS The find command is "unnecessarily" complicated having to enumerate all the queuing directories, due to /var/spool/postfix being setup as a chroot (at least in Debian), and having binary/library/dev/configuration files under that subtree area.
| what does "postsuper -d ALL" do on the filesystem? |
1,483,525,455,000 |
Operating system Ubuntu Linux 18.04.2
Webmin version 1.900 (latest)
Usermin version 1.751 (latest)
Virtualmin version 6.06-2 (latest)
I have a problem with Dovecot & Usermin/Virtualmin.
The problem affects ONLY domain users (main virtual server users) - all additional users created, can login to Usermin and access emails ok.
So when I create a new virtual server called test.com, I click the 'login to usermin' button from 'edit user section' and Usermin opens & logs the user 'test' in.
Immediately you will see this in syslog and mail.log:
Jul 7 00:49:17 ns1 dovecot: imap-login: Disconnected (auth failed, 1 attempts in 6 secs): user=<>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured, session=<abVjLgqNer1/AAAB>
Jul 7 00:49:17 ns1 dovecot: imap-login: Disconnected (auth failed, 1 attempts in 8 secs): user=<>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured, session=<eapMLgqNeL1/AAAB>
Jul 7 00:49:28 ns1 dovecot: imap-login: Disconnected (auth failed, 1 attempts in 10 secs): user=<>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured, session=<4ynZLgqNfL1/AAAB>
Jul 7 00:49:45 ns1 dovecot: imap-login: Disconnected (auth failed, 1 attempts in 27 secs): user=<>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured, session=<sKHZLgqNfr1/AAAB>
Jul 7 00:49:45 ns1 dovecot: imap-login: Disconnected (auth failed, 1 attempts in 17 secs): user=<>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured, session=<t5RqLwqNgL1/AAAB>
auth.log:
Jul 7 00:49:06 ns1 perl: pam_unix(usermin:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost= user=root
I found similar issues here:
https://www.virtualmin.com/node/38732
The difference is that my user is shown blank in the log. Also, I have no inbox.imap file in directory /home/test/.usermin/mailbox
and here:
https://www.virtualmin.com/node/64389
How do I go about fixing this? Any ideas?
service dovecot status = active (running)
dovecot -n
2.2.33.2 (d6601f4ec): /etc/dovecot/dovecot.conf
Pigeonhole version 0.4.21 (92477967)
OS: Linux 4.15.0-54-generic x86_64 Ubuntu 18.04.2 LTS
auth_mechanisms = plain login
disable_plaintext_auth = no
mail_location = maildir:~/Maildir
mail_privileged_group = mail
namespace inbox {
inbox = yes
location =
mailbox Drafts {
special_use = \Drafts
}
mailbox Junk {
special_use = \Junk
}
mailbox Sent {
special_use = \Sent
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox Trash {
special_use = \Trash
}
prefix =
}
passdb {
driver = pam
}
protocols = imap pop3 pop3
ssl_ca = </dovecot.key.ca
ssl_cert = </etc/dovecot/private/dovecot.pem
ssl_cipher_list = ECDHE-RSA-AES256-SHA384:AES256-SHA256:AES256-SHA256:RC4:HIGH:MEDIUM:+TLSv1:+TLSv1.1:+TLSv1.2:!MD5:!ADH:!aNULL:!eNULL:!NULL:!DH:!ADH:!EDH:!AESGCM
ssl_client_ca_dir = /etc/ssl/certs
ssl_key = # hidden, use -P to show it
userdb {
driver = passwd
}
local_name test.com {
ssl_cert = </home/test/ssl.cert
ssl_key = # hidden, use -P to show it
}
local_name www.test.com {
ssl_cert = </home/test/ssl.cert
ssl_key = # hidden, use -P to show it
}
local_name mail.test.com {
ssl_cert = </home/test/ssl.cert
ssl_key = # hidden, use -P to show it
}
|
After a whole day of testing, I discovered that this problem happens when one does not run the Virtualmin post-config wizard.
In this case, the file /etc/usermin/mailbox/config is left at the default configuration mail_system=4. Changing this to mail_system=1, fixes the problem when using hashed passwords.
The section responsible for the above actions in the Virtualmin post-config wizard is the part where it asks you whether to use plain passwords or hashed passwords.
| dovecot: imap-login: Disconnected auth failed user=<> |
1,483,525,455,000 |
Background: I'm trying to set up a server to regularly pull RSS feeds, package them up in a mobi-ebook and send them to my kindle.
Problem: If I configure the server to send to my @kindle.com email address (as described here: https://www.amazon.com/gp/sendtokindle/email) I get back an email telling me:
Your email to Kindle(s) did not include any attachments.
I'm using the following command to send the email with attachment:
echo "See attachment" | mail -s subject -aFrom:"$EMAIL_FROM" -A $EMAIL_FILE -r $EMAIL_FROM $EMAIL_TO
I tested this command by sending it to my personal email address instead of the @kindle.com one. The email appeared correctly with attachment in my personal inbox.
Interestingly it works fine (as in the ebook appears on my kindle) if I use mutt like this:
echo "See attachment" | mutt -s subject -a $EMAIL_FILE -- $EMAIL_TO
I'm using postfix to forward the emails to a hosted smtp server. I already checked the postfix logs (/var/log/mail.log) but couldn't see any differences between the two methods above. The server is running Ubuntu 18.04.
Question: Why does it work with mutt but not with mail? How would I troubleshoot such an issue?
Requested information
The headers from mutt (Please let me know if I stripped out too much):
Delivered-To: [...]
Received: by 2002:a2e:9c0f:0:0:0:0:0 with SMTP id s15-v6csp1355528lji;
Sat, 10 Nov 2018 10:47:03 -0800 (PST)
[... removed X-* ...]
[... removed ARC-* ...]
Date: Sat, 10 Nov 2018 18:46:44 +0000
From: [...]
To: [...]
Subject: mutt
Message-ID: <20181110184643.GA23337@server>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="5mCyUwZo2JvN/JJP"
Content-Disposition: inline
User-Agent: Mutt/1.9.4 (2018-02-28)
[... removed X-* ...]
--5mCyUwZo2JvN/JJP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
See attachment
--5mCyUwZo2JvN/JJP
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="20181024T0942.mobi"
Content-Transfer-Encoding: base64
--5mCyUwZo2JvN/JJP--
Headers from mail:
Delivered-To: [...]
Received: by 2002:a2e:9c0f:0:0:0:0:0 with SMTP id s15-v6csp1355767lji;
Sat, 10 Nov 2018 10:47:23 -0800 (PST)
[... removed X-* ...]
[... removed ARC-* ...]
MIME-Version: 1.0
Content-Type: application/octet-stream; name="20181024T0942.mobi"
Content-Transfer-Encoding: base64
Subject: mail
To: [...]
X-Mailer: mail (GNU Mailutils 3.4)
Message-Id: <[email protected]>
Date: Sat, 10 Nov 2018 18:47:07 +0000 (UTC)
From: [...]
[... removed X-* ...]
Upon closer inspection I noticed that the one from mail is missing the text "See attachment".
Versions:
jonas@server:~$ mutt -v
Mutt 1.9.4 (2018-02-28)
[...]
jonas@server:~$ mail --version
mail (GNU Mailutils) 3.4
[...]
jonas@server:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.1 LTS
Release: 18.04
Codename: bionic
According to the man page on the server I'm using -A correctly:
-A, --attach=FILE
attach FILE
-a, --append=HEADER: VALUE append given header to the message being sent
|
I'm fairly sure what is happening here is that your mail program is sending its attachments using uuencode format, while mutt sends them in MIME format.
uuencode is an outdated email format and has been largely superceded by MIME, so I wouldn't be surprised that the handler for @kindle.com would not be able to recognize uuencode format, only MIME.
It's hard to tell how your mail command will behave (from your question) since there are many implementations of mail shipped by different Linux distributions (many of which do not even support attachments at all.) If you give more details about your Linux distribution, package which owns the mail binary and perhaps some reference from man mail, we can try to confirm that. (Also, perhaps the man page might have details about using uuencode format for attachments or MIME support or lack thereof. Look there to see if you find more.)
One way to confirm this is to send mail with attachments to yourself using both mail and mutt and look at the raw email body. You should be able to tell whether it looks like uuencode or MIME.
uuencode looks something like this:
begin 644 myebook.pdf
While MIME looks like this:
Content-Type: application/pdf
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=myebook.pdf
UPDATE: From the headers you included, it looks like your mailer is using MIME, but as you noticed yourself, it's not sending the file as an attachment (which would have been marked with Content-Disposition: attachment), but as the main body of the email (ignoring the body you supplied.)
The GNU mailutils documentation on MIME implies that this should work as you expected to, for instance it states:
All the examples above will enter the usual interactive shell, allowing you to compose the body of the message. If that’s not needed, the non-interactive use can be forced by redirecting /dev/null to the standard input, e.g.:
$ mail --attach=archive.tar < /dev/null
My understanding of the "interactive shell" is that it's waiting for you to type the message body, but accepts commands starting with a special character (~), which makes it a command interpreter too.
Perhaps try to use mail without piping the body into it, to see if it's expecting some input, and then see if it accepts an email body if you type it directly?
| Sending attachments with GNU mail to @kindle.com |
1,483,525,455,000 |
I have created a script to shutdown Oracle database but unable to send the output of shutdown while the database shutdown completes successfully.
I only receive email of the echo part but not the actual part of shutdown. I want to capture the output of shutdown and send it via mailx to my emailid.
Also let me know how to capture this log in HTML format and send it via emailid.
LOG_FILE="Shutdown_of_$ORACLE_SID_`hostname`_Completed_`date "+%Y_%b_%d"`.txt"
echo "">>$LOG_FILE
echo "">>$LOG_FILE
echo " ========================================================= ">>$LOG_FILE
echo "">>$LOG_FILE
echo " Step : SHUTTING Down of database ">>$LOG_FILE
echo " Start : `date ` ">>$LOG_FILE
echo " ======================================================== ">>$LOG_FILE
echo "">>$LOG_FILE
echo "">>$LOG_FILE
export SHUT=/home/oracle/SHUT.txt
>$SHUT
sqlplus -s / as sysdba << EOF
set feedback off verify off termout off linesize 120 pagesize 500;
spool $SHUT
shut immediate;
spool off;
exit;
EOF
echo "">>$LOG_FILE
echo " ========================================= " >>$LOG_FILE
echo " Status : Completed ">>$LOG_FILE
echo " End : `date` ">>$LOG_FILE
echo " ========================================= ">>$LOG_FILE
echo "">>$LOG_FILE
mailx -s "Shutdown_of_'$ORACLE_SID'_`hostname`_Completed_`date "+%Y_%b_%d"` " [email protected] < $LOG_FILE
NOTE: My Bash version: GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu).
|
I generally do what you want like this:
#!/bin/bash
{
cat <<-EOF
=========================================================
Step : SHUTTING Down of database
Start : `date `
========================================================
EOF
export SHUT=/home/oracle/SHUT.txt
>$SHUT
sqlplus -s / as sysdba <<-EOF
set feedback off verify off termout off linesize 120 pagesize 500;
spool $SHUT
shut immediate;
spool off;
exit;
EOF
cat $SHUT
cat <<-EOF
=========================================
Status : Completed
End : $(date)
=========================================
EOF
} | mailx -s "Shutdown_of_'$ORACLE_SID'_$(hostname)_Completed_$(date "+%Y_%b_%d") " \
[email protected]
The above creates a subshell which will capture all the output from the commands within it. We then pipe all this output to mailx directly.
NOTE: Pay special attention to any additional spacing around the EOF markers when using heredocs. An errant extra space at the end of the EOF can lead to it not working.
References
3.2.4.3 Grouping Commands
Can't indent heredoc to match nesting's indent
| Capture of logs in HTML and send via email? |
1,483,525,455,000 |
Need to get a comma delimited list filenames in an email. Here is some input examples with 1 having lots of special characters:
Content-Disposition: attachment;
filename="How-To_21_Monitor_Mode_Deployment_Guide.pdf"; size=3886046;
creation-date="Fri, 27 Oct 2017 16:23:20 GMT";
modification-date="Fri, 27 Oct 2017 16:24:30 GMT"
Content-Disposition: attachment; filename="How-To_24_Low_Impact_Mode.pdf";
size=6714113; creation-date="Fri, 27 Oct 2017 16:23:20 GMT";
modification-date="Fri, 27 Oct 2017 16:24:31 GMT"
Content-Disposition: attachment;
filename="SBTGxYVWPE1wI9SAjl5b2PUfF1LCjbU3aChsoch5eXuI4GrIP9bRhfiaOuwL1U
;.,~!@#$%....txt"; size=3966; creation-date="Fri, 27 Oct 2017 16:23:20 GMT";
modification-date="Fri, 27 Oct 2017 16:23:20 GMT"
This works, but concerned if it went more than 3 lines and it is not efficient:
grep --no-group-separator --line-buffered -A 2 '^Content-Disposition: ' | sed -e '/\;$/!{N;s/\n//}' -n -e 's/.*filename\=//p' | sed -e 's/ size\=.*//' | sed 's/\;$//' | sed ':a;N;$!ba;s/\n/,/g'
Tried to get it working with a single sed line:
sed -n '/^Content-Disposition: /,/\"\; size\=/{/\;$/!{x;N;s/\n//g}};s/.*filename\=//p;s/ size\=.*//;s/\;$//;:a;N;$!ba;s/\n/,/g;
Would be appreciated for a single command preferably with sed.
|
to get a comma delimited list filenames in an email
GNU awk solution:
awk -v RS='\n\n' 'BEGIN{ fn="" }
match($0, /filename="([^"]+)";[[:space:]]+size=/, a){
gsub(/[[:space:]]*/, "", a[1]);
fn = (fn!=""? fn", ":"")a[1]
}END{ print fn }' file
fn - the resulting string containing all the filenames(after processing)
-v RS='\n\n' - set record separator as double linebreak
/filename="([^"]+)";[[:space:]]+size=/ - regex pattern to capture the filename in each Content-Disposition header into array of matches a
The output:
How-To_21_Monitor_Mode_Deployment_Guide.pdf, How-To_24_Low_Impact_Mode.pdf, SBTGxYVWPE1wI9SAjl5b2PUfF1LCjbU3aChsoch5eXuI4GrIP9bRhfiaOuwL1U;.,~!@#$%....txt
| Parsing filename from raw email |
1,483,525,455,000 |
Below script works fine in my Linux server.
(
echo "From: [email protected]";
echo "To: [email protected]";
echo "Subject: Test Subject";
echo "Content-Type: text/html";
echo "MIME-Version: 1.0";
echo "";
echo "<html><head><title>HTML E-mail</title></head>
<body><p>Test Body Message</p></body></html>";
) | sendmail -t
But after modify the script as below, it shows error as "No recipient address found in header". Is it possible to workout the below code using variable. I don't want to use any file or any other mail command except sendmail.
var1='(
echo "From: [email protected]";
echo "To: [email protected]";
echo "Subject: Test Subject";
echo "Content-Type: text/html";
echo "MIME-Version: 1.0";
echo "";
echo "<html><head><title>HTML E-mail</title></head>
<body><p>Test Body Message</p></body></html>";
)'
echo ${var1} | sendmail -t
|
command substitution will replace end of line by space.
use ;" instead of ";
use tr \; '\n' to renable end of line.
use awk to de-indent first char as space
put To: line first
this result in somehow ugly
var1=$(
echo "To: [email protected];"
echo "From: [email protected];"
echo "Subject: mail HTML ;"
echo "Content-Type: text/html;"
echo "MIME-Version: 1.0;"
echo ";"
echo "<html><head><title>HTML E-mail</title></head>
body><p>Test Body Message</p></body></html>"
)
## can be one-lined, pipe symbol (|) continue line.
echo ${var1} | tr \; '\n' |
awk 'length == 1 || NR == 1 {print $0} length && NR > 1 { print substr($0,2) }' |
sendmail -t
this however my break some html code ( like á turn to á ), you know that mail can send attachment now days ?
man mail
-A, --attach=FILE
attach FILE
mail -A <(generate HTML result) [email protected]
| Send html format mail stored in variable using sendmail command |
1,483,525,455,000 |
I have a list of 20 e-mail addresses that I'm trying to put in a macro variable as multiple rows in a shell script. In "wide" format it works fine and appears as:
to_list="[email protected],[email protected],[email protected],[email protected]"
I want something like below, and I'm having trouble with the quotes, commas, and line breaks:
to_list="[email protected],[email protected], \
.
.
.
[email protected],[email protected]"
The usage will be:
mail -s "Subject text here." $to_list < body_text.txt
According to the syntax the e-mails should be comma separated and only the entire list should be wrapped in quotes as shown in the wide format. However, my test is only sending e-mails to the top row. I appreciate the insight!
|
You want something like this:
to_list=(
"[email protected],"
"[email protected],"
"[email protected],"
"[email protected]"
)
mail -s "Subject text here." "${to_list[@]}" < body_text.txt
That is using an array, where you were trying to create a string.
| Put long list of e-mail addresses in multiple-row macro variable |
1,483,525,455,000 |
I have a Debian Jessie (Version 8.1) server that serves multiple domain names. Each has their own folder configured under /var/www/. Each domain name has a unique conf (example.com.conf) file under /etc/apache2/sites-enabled which is linked to a matching conf file under /etc/apache2/sites-available. Each conf file has:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/example_com_dir
ServerName example.com
ServerAlias *.example.com
</VirtualHost>
I wanted to be able to accept all emails sent to each of the domains (any email sent to any [email protected]) and forward it to my Gmail. I successfully installed EXIM4 on it, and configured using dpkg-reconfigure exim4-config as follows:
mail sent by smarthost; no local mail
System mail name: myDomainName.TLD
IP-addresses to listen on for incoming SMTP connections: 127.0.0.1 ; ::1
Other destinations for which mail is accepted: <BLANK>
Visible domain name for local users: <BLANK>
IP address or host name of the outgoing smarthost: smtp.gmail.com::587
Keep number of DNS-queries minimal (Dial-on-Demand)? No
Split configuration into small files? No
Root and postmaster mail recipient: <BLANK>
Then I completed all the other steps in this tutorial:
https://www.vultr.com/docs/setup-exim-to-send-email-using-gmail-in-debian.
Inside /etc/hosts I have:
127.0.0.1 localhost
127.0.1.1 install.install install
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Inside /etc/hostname I have one line: example.com
Inside /etc/email-addresses I have:
root: [email protected]
info: [email protected]
*: [email protected]
When I run echo 'Test Message.' | mail -s 'Test Message' [email protected] I do get an email in my Gmail. Also, if a run any script from cron.d and it outputs any prints, I do get those as email notifications. So I know outgoing emails work. But when I send an email from [email protected] to [email protected] I do not get any notification in [email protected].
Question #1:
I want to be able to get all incoming emails and forward them to somewhere else. For example, I want to send from [email protected] to my domain [email protected] and have the server send it to [email protected]. What do I have to configure in order to do so? How can that be configured for a server serving multiple domains?
Question #2:
I know it might be opinion based, but what are some of the free, user friendly, with web GUI access email servers that I can configure on Debian Jessie (8.1)?
|
Reconfigure your config by running
# dpkg-reconfigure exim4-config
General type of mail configuration: internet site
Other destinations for which mail is accepted: example.com
IP-addresses to listen on for incoming SMTP connections: fill in your IP address
Those should be the most important items to change. Remove any smarthost if it's still asked.
Now it should accept incoming SMTP connections (if you entered the IP address correctly), and send email on via the aliases you're already created.
| How to configure EXIM4 to relay emails? |
1,483,525,455,000 |
describing my specific case; on our centOS 6.6 final servers , I've installed yum-cron, in order to schedule a check every night if there are updates from the active repositories.
I preferred to avoid the auto-installation, also following is the snippet of config file : /etc/sysconfig/yum-cron :
# Pass any given paramter to yum, as run in all the scripts invoked
# by this package. Be aware that this is global, and yum is invoked in
# several modes by these scripts for which your own parameter might not
# be appropriate
YUM_PARAMETER=
# Don't install, just check (valid: yes|no)
CHECK_ONLY=yes
# Check to see if you can reach the repos before updating (valid: yes|no)
CHECK_FIRST=no
At the beginning I've configured also the MAILTO parameter, in order to receive the notification email externally (eg.: [email protected]), but some week later I've started thinking it was not a really good practice to send out via email information about installed packages, also I modified MAILTO parameter in order to keep these info inside the server, like this:
# by default MAILTO is unset, so crond mails the output by itself
# example: MAILTO=root
MAILTO=root
The only remaining problem, is that it is not very handy to go check internal email everytime, without know if there are updates. For this reason I was thinking if it somebody knows a way to send an external notification to [email protected] (eg: "user root @ server A received an internal email) without saying any other information
Thanks in advance for any suggestion
|
Check if the mailbox file for root (possibly /var/mail/root) is more recent than that of a file touched by the previous check. If so, generate a mail. Regardless, touch the last-checked file. Run this script from cron.
#!/bin/sh
FILE_TO_CHECK=/var/mail/root
LAST_RUN_FILE=/root/.mailboxcheck
if [ $FILE_TO_CHECK -nt $LAST_RUN_FILE ]; then
echo "file is newer, hooray"
fi
touch $LAST_RUN_FILE
Another option would be to collect the mail spools somewhere (e.g. via rsync) and then have a webpage or some other sort of dashboard showing that collected information.
| Postfix - external email notification when an internal email is received |
1,483,525,455,000 |
It must be soooo simple, but all of the examples that I found after a few hours of googling don't work, as the mail is always attached to the file instead of writing it into the body.
I don't want to send empty messages either, but want to send mail only when I have output from the script. Here is my command:
$script_file > /tmp/output.log ; mail -E -s "Output subject" "my@emailaddress" < /tmp/output.log ; rm -f /tmp/output.log
Would it be possible to change this command to force the mail to embed the content of the output.log file?
My system is CentOS.
Many thanks!
|
I use mutt to do that, like this. Be aware of argument order, do not place recipient after -a
mutt [email protected] -s "Mail subject" -a /file/to/attach < /file/with/mail/body
| How to embed file content into body of the email using mail command? |
1,483,525,455,000 |
When I login into my vps,
ssh -D 127.0.0.1:1080 [email protected]
[email protected]'s password:
Linux born 3.2.0-4-686-pae #1 SMP Debian 3.2.65-1+deb7u1 i686
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have mail.
Last login: Fri Feb 27 02:07:55 2015 from my vps ip .
Where is the mail?
|
The message is given by your shell, according to the MAIL environment variable. If that variable contains the name of a file, and that file is non-empty, the shell will say "You have mail". The shell then remembers the timestamp of the file and won't mention mail again until that timestamp changes.
If the file is non-empty, and the modification time is later than the access time, then the shell will say "You have new mail", note the addition of the word "new" there.
You can read mail with the mail or mailx commands, but for a fullscreen experience try the mutt command. It's the only mail user agent I use, as I find it a lot quicker and handier to use than any GUI mail programs. It does get a bit of getting used to, though, but like vim you'll soon be glad you invested the time.
| motd message, when I log in using ssh, tells me I have a mail, how I can check it? |
1,483,525,455,000 |
In our postfix server, the mail directories cur and new are under /home/<user>/Maildir. I don't have much of an experience with mail servers, but I am aware that new e-mails land in the new folder first, and once read, they get moved to the cur folder.
[root@imap01 cur]# ls | head -5
1414497605.Vfd02I42dcbM893399.imap01.xyz.com:2,S
1414497605.Vfd02I42dceM901537.imap01.xyz.com:2,S
1414497606.Vfd02I42dcfM227925.imap01.xyz.com:2,S
1414584047.Vfd02I42deeM736282.imap01.xyz.com:2,S
1414584047.Vfd02I42df0M736415.imap01.xyz.com:2,S
[root@imap01 cur]#pwd
/home/userabc/Maildir/cur
[root@imap01 cur]#
The :2,S suffix is getting added to the files once they are moved to cur. Now my questions are:
How can I mark a read mail as unread through commandline?
Is it as simple as moving the mail from cur folder to new folder?
Is it as simple as removing the :2,S suffix from the mail files ?
|
Turns out that all we had to do was to combine the last 2 steps I had asked in the question.
Copy the e-mail file, (ie. 141443305.abc123abc.imap01.xyz.com:2,S) from /home/<user>/Maildir/cur to /home/<user>/Maildir/new and rename it by removing the :2,S suffix. This process marks the read mail as unread.
| How to mark read mails as unread in Postfix |
1,483,525,455,000 |
I need to get a look at how my SSL mailserver plays with others; for non-SSL this is easy to do with (e.g.) telnet. Is there a bonified SSL/TLS client that can be used the same way?
|
Yep, gnutls-cli, but there are a few minor tricks required to get it to work.
gnutls-cli --crlf foobar.com -p 465
Some online tutorials for this use -s foobar.com. This does not seem to be necessary, although if the above fails you could try it. If you use -s you will have to hit CtrlD (to send EOF) afterward in order to initiate the TLS session.
--crlf is required because the (E)SMTP protocol uses a DOS style carriage return, line feed to end lines. Without this the server will not respond.
-p is for port, and here I've used the fairly standard 465 for SMTP over SSL.
You should see some (copious) output regarding the server's certificate ending with:
- Handshake was completed
- Simple Client Mode:
And hopefully right after that the first statement from the server:
220 mailserver1.foobar.com ESMTP
You can now do whatever it was you were thinking of doing with telnet; since in this case it is ESMTP we use EHLO instead of HELO
EHLO fake.org
The server should reply with a list of characteristics/capabilities, or perhaps if very vigilant, say sorry, "fake.org" appears to be a lie ;)
| Check SMTP over SSL |
1,483,525,455,000 |
I'd like to know if it is possible to configure postfix to redirect to many email addresses (including the original recipient) instead of only one?
Here is my scenario:
When an e-mail is:
Sent from: [email protected]
Addressed to: [email protected]
Result: redirect e-mail to [email protected] and deliver to the original recipient
The question is partly answered here:
https://serverfault.com/questions/284702/redirect-specific-e-mail-address-sent-to-a-user-to-another-user
|
I fixed the problem with procmail.
Source: http://www.netikka.net/tsneti/info/proctips.php#forward
Below is an example:
#Get the sender's bare email address from the first "From" line
FROM_=`formail -c -x"From " \
| expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g' \
| awk '{ print $1 }'`
#Get the original subject of the email
#Discard superfluous tabs and spaces
#On some systems -xSubject: has to be -x"Subject: "
SUBJ_=`formail -c -xSubject: \
| expand \
| sed -e 's/ */ /g' \
| sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
#Whatever other recipes you'll use
:0
* ^From:.*infolist@([-a-z0-9_]+\.)*infohost\.infodom
# Avoid email loops
* ! ^X-Loop: myid@myhost\.mydom
{
:0c: #Preserve a copy of the email
Infolist.mail
:0fwh #Adjust some headers before forwarding
| formail -A"X-Loop: [email protected]" \
-A"X-From-Origin: ${FROM_}" \
-i"Subject: $SUBJ_ (fwd)"
# Forward the email
:0
[email protected]
}
| Redirect specific e-mail address sent to a user, to other email-recipients |
1,483,525,455,000 |
I am trying to block inbound emails for no-reply user and allow it to send emails at the same time. I tried editing the configuration in /etc/mail/virtusertable with:
[email protected] error:5.7.0:550 Invalid Address
But when I tried sending a test email with root, the email got bounced back to my postmaster with the "Invalid Address" error. So, I guess the setting affects both sending and receiving of mails.
As I need to receive emails for some other users, is there anyway I can block incoming mails and yet allow outgoing ones without closing inbound port 25 on my firewall?
|
I would add an entry to your /etc/aliases file like so:
no-reply: /dev/null
Be sure to rebuild the aliases database with the newaliases command afterwards.
References
How can I point an email alias at /dev/null?
| How to block incoming and allow outgoing mails for a no-reply user on Sendmail? |
1,483,525,455,000 |
I received a really classic spam mail stating that I have to pay a bill. The mail included an attachment (.exe).
Just for curiosity reasons: What would happen if I click on the attachment? (I am running Crunchbang, no Wine installed)?
Is there a way to securely inspect the attachment?
|
Nothing would happen since a .exe file is meant for Windows, not Linux, so without Wine installed, and without a association to run .exe files from your mail client these files are essentially of no consequence to you.
Still as a best practice you should typically never run things directly from email. You should instead get in the habit of doing a "Save As..." and then inspecting the file using tools such as file to confirm the file is as it's labeled.
Example
$ file <name of file>
If it looks clean then go ahead and open it.
Scanning for malware
If you're genuinely serious about scanning email for viruses/malware then there are a few tools and techniques I've used over there years. Before I get into it I'll suggest just punting and using GMail instead. They do a fantastic job and you can use fetchmail to download all the mail from GMail and still use mutt to read and send emails.
If on the other hand you're "into" doing everything yourself you can use these tools from mutt. For starters you can use spamassassin to scan incoming email.
Recipes in mutt such as this will run all messages through spamassassin:
:0fw
| spamassassin -P
:0e
EXITCODE==$?
You can also use a spam detection network to scan and flag emails from mutt using Vipul's Razor.
Vipul's Razor is a distributed, collaborative, spam detection and filtering network. Through user contribution, Razor establishes a distributed and constantly updating catalogue of spam in propagation that is consulted by email clients to filter out known spam. Detection is done with statistical and randomized signatures that efficiently spot mutating spam content. User input is validated through reputation assignments based on consensus on report and revoke assertions which in turn is used for computing confidence values associated with individual signatures.
NOTE: Setting both of these up is covered in this tutorial, titled: Spam-Fighting Tricks.
Mail servers
If you're really a masochist you can run your own mail server (I do this, using sendmail). With your own mail server you have a even larger arsenal of tools available such as:
spamassassin
milter-greylist
GeoIP
clamav
spamassassin-milter
clamav-milter
SPF
The above tools range from using a mix of online databases of emails that are known to be malware related, to blocking emails based on the geographic IP address that sent them to using DNS rules via SPF (Sender Policy Framework).
These solutions are what I would consider more enterprise grade but work very well, but require a fair amount of time and knowledge in setting them up and tending to them afterwards.
References
How to Setup a Mail Server on CentOS 5
| Securely inspect email attachment |
1,483,525,455,000 |
I have a small postfix server, on a Linux server (Arch Linux) mainly used as a http server.
I use postfix to send database backups and notifications of my web sites. To avoid spamming, I'd like to monitor the output mail queue (e.g. a report of sent emails).
Is there a simple way to do that?
|
You could set up a cron job to run the pflogsumm postfix log analyser and send you a report.
If pflogsumm does not suit your requirements there are other alternative log analysis tools listed at http://www.postfix.org/addon.html#logfile
| Notify on email sent - Postfix |
1,483,525,455,000 |
I've set up postfix (Debian) and it works fine. I can recieve mail and I can send them, but I can only send them to local (and local virtual) adresses.
But when I try to send the mail for example to my Gmail account, I get this in syslog:
Jun 30 18:34:44 vps postfix/smtpd[9087]: NOQUEUE: reject: RCPT from vps[77.93.223.122]: 554 5.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<localhost.localdomain>
I've googled a lot but I did figure it out thought. I think that something is wrong with my* directives. Here are mine:
myhostname = mail.xxx.cz
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = xxx.cz, vps, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
|
You need to allow relaying for hosts you trust.
If vps has a static IP address, you might simply add it to mynetworks. Another popular option is to set up authentication between trusted hosts
See furthermore http://www.postfix.org/SMTPD_ACCESS_README.html
| Postfix - unable to send mails to Internet (i.e. Gmail) |
1,483,525,455,000 |
I'm trying to configure a simple mail server on OpenBSD 5.2, running OpenSMTPD 5.3.1, however there is some problem with my configuration file, and I'm unsure how to fix it. I can send and receive local mail on the computer, but I cannot send external mail from the computer, nor receive it. The following is my smtpd.conf And yes, "mydomain.com" is a real domain, that's just a filler.
listen on lo0
listen on bce0
table aliases db:/etc/mail/aliases.db
# accept local mail
accept from local for local deliver to mbox
# accept remote mail
accept from any for domain "mydomain.com" deliver to mbox
# allow remote delivery of mail
accept from local for any relay
Perhaps it's not doing what I think it is, but any help would be much appreciated.
|
The configuration file is OK except you're missing a reference to the aliases table in your accept rules:
accept from any for domain mydomain.com alias <aliases> deliver to mbox
You can run with smtpd -dv -T smtp to get incoming session tracing and see where it fails ;-)
| OpenSMTPD Configuration Problem |
1,336,420,297,000 |
Why am I receiving this error message on Kubuntu since I upgraded to 12.04 and how can I make it stop appearing? It appears as a pop up balloon above the system tray.
Mail Dispatcher Agent: Could not access the outbox folder (Unknow error. (Failed to fetch the resource collection.)).
|
This forum thread discusses the issue and includes various solutions/workarounds, such as deleting /.config/akonadi,
Rather than removing the akonadi configuration, I edited ~/.config/akonadi/aknoadiserverrc and changed StartServer=true to StartServer=false, and then rebooted (although logging out and back in should have been sufficient). (1)
or this one
Hi,
I had the same problem here, also on a Kubuntu system that has undergone many distribution upgrades.
I found the following solution without having to delete Akonadi's configuration or disabling it completely:
In the "Akonadi configuration" dialog (where you configure the Akonadi ressources), I had an e-mail ressource named "Local Folder". Deleting it made the startup warning go away. (2)
| Mail Dispatcher Agent: Could not access the outbox folder (Unknow error. (Failed to fetch the resource collection.)) |
1,336,420,297,000 |
Ignoring the fact that not all mail servers support TLS:
Is there a way to announce to the world that we would prefer that our inbound mail be delivered via TLS and verified as signed by a trusted CA?
Relatedly, can we announce to the world that they should only accept outbound mail from us (ie, MAIL FROM) if the connection is TLS? (I realize they can't know if we verified their cert, but they can know if it was via TLS.)
Either SPF or DMARC seems like a good place to indicate that, but I've not seen support for such a thing.
|
There is the MTA-STS standard for exactly this purpose. It is similar to HSTS in that it declares that the server should be accessed by TLS only. Unlike HSTS it is declared in DNS, so this feature detection can be part of the normal DNS lookups when trying to figure out which server should be used to deliver the mail (i.e. MX lookup).
| Is there a DNS-based policy like SPF or DMARC to require STARTTLS sessions for a given domain? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.