Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
1
answers
32
views
Playing an audio file using Procmail does not work (no audio card found)
I have a strange issue on my Debian server. I am receiving mails with Postfix and "Procmail" for the user `notfall`. After a mail was received, the script from Procmail should play an audio file. But it does not find any audio card. If I issue the command `aplay -l` interactively, I can see the exis...
I have a strange issue on my Debian server. I am receiving mails with Postfix and "Procmail" for the user
notfall
. After a mail was received, the script from Procmail should play an audio file. But it does not find any audio card.
If I issue the command aplay -l
interactively, I can see the existing audio cards:
$ aplay -l
**** Liste der Hardware-Geräte (PLAYBACK) ****
Karte 0: PCH [HDA Intel PCH], Gerät 0: 92HD81B1X5 Analog [92HD81B1X5 Analog]
Sub-Geräte: 1/1
Sub-Gerät #0: subdevice #0
Karte 0: PCH [HDA Intel PCH], Gerät 3: HDMI 0 [HDMI 0]
Sub-Geräte: 1/1
Sub-Gerät #0: subdevice #0
Karte 0: PCH [HDA Intel PCH], Gerät 7: HDMI 1 [HDMI 1]
Sub-Geräte: 1/1
Sub-Gerät #0: subdevice #0
Karte 0: PCH [HDA Intel PCH], Gerät 8: HDMI 2 [HDMI 2]
Sub-Geräte: 1/1
Sub-Gerät #0: subdevice #0
The first one is the correct one: Karte 0: PCH [HDA Intel PCH], Gerät 0: 92HD81B1X5 Analog [92HD81B1X5 Analog]
The script is as follows:
$ cat alarm.sh
#!/bin/bash
aplay -l
ffplay -nodisp -autoexit /home/notfall/beep.wav
sleep 1
Whenever a new mail from ilo@pentest.internal
is received, the script is executed, but I get the following errors in the procmail.log file:
From ilo@pentest.internal Fri Jul 25 13:22:07 2025
Subject: =?utf-8?q?HPE=20iLO=20AlertMail=2D058=3A=20=28INFO=29=20AlertMail=20T
Folder: /home/notfall/alarm.sh 2223
aplay: device_list:279: no soundcards found...
ffplay version 7.1.1-1+b1 Copyright (c) 2003-2025 the FFmpeg developers
built with gcc 14 (Debian 14.2.0-19)
configuration: --prefix=/usr --extra-version=1+b1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-libmfx --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
libavutil 59. 39.100 / 59. 39.100
libavcodec 61. 19.101 / 61. 19.101
libavformat 61. 7.100 / 61. 7.100
libavdevice 61. 3.100 / 61. 3.100
libavfilter 10. 4.100 / 10. 4.100
libswscale 8. 3.100 / 8. 3.100
libswresample 5. 3.100 / 5. 3.100
libpostproc 58. 3.100 / 58. 3.100
Input #0, wav, from '/home/notfall/beep.wav': 0KB sq= 0B
Metadata:
title : we5
Duration: 00:00:01.23, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le ( / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1342:(snd_func_refer) error evaluating name
ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM default
SDL_OpenAudio (2 channels, 44100 Hz): ALSA: Couldn't open audio device: No such file or directory
ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1342:(snd_func_refer) error evaluating name
ALSA lib conf.c:5205:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5728:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2722:(snd_pcm_open_noupdate) Unknown PCM default
SDL_OpenAudio (1 channels, 44100 Hz): ALSA: Couldn't open audio device: No such file or directory
No more combinations to try, audio open failed
Failed to open file '/home/notfall/beep.wav' or configure filtergraph nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B
The message aplay: device_list:279: no soundcards found...
indicates that no audio cards were found. **This is the issue that I don't understand, since the script is executed by the same user.** Even more interestingly, the script works when being executed in a cronjob. The user is always logged in graphically.
**Do you folks have any idea why the script can't find the audio card?**
Thank you!
Michael Gierer
(135 rep)
Jul 28, 2025, 11:20 AM
• Last activity: Jul 28, 2025, 12:01 PM
0
votes
0
answers
30
views
How to add ",a" flag to the filename delivered in maildir by procmail?
I learned that by adding ",a" to the file name in a maildir, the Evolution software considers the mail as an important message. So I would like to tag some messages using Procmail but whatever I do, I go around in circles, because I do not know the file name before it is delivered by Procmail, and w...
I learned that by adding ",a" to the file name in a maildir, the Evolution software considers the mail as an important message.
So I would like to tag some messages using Procmail but whatever I do, I go around in circles, because I do not know the file name before it is delivered by Procmail, and when it is already delivered, it is immediately renamed by various external mechanisms by moving it from
new
to cur
.
Is there a solution only with Procmail?
I know other solutions, but they do not interest me here.
Chris972
(43 rep)
Nov 30, 2024, 05:44 PM
• Last activity: Dec 1, 2024, 08:46 AM
0
votes
1
answers
29
views
procmail recipe assistance
I know just enough about regexp to make my brain hurt and I was hoping for some assistance. I need a recipe to take any mail that doesn't have the string "ZYX" in the TO: line and dump it into "0.waste". Would someone be willing to lend a hand?
I know just enough about regexp to make my brain hurt and I was hoping for some assistance.
I need a recipe to take any mail that doesn't have the string "ZYX" in the TO: line and dump it into "0.waste". Would someone be willing to lend a hand?
Stefinatrix
(1 rep)
Mar 21, 2024, 06:15 PM
• Last activity: Mar 21, 2024, 06:57 PM
4
votes
2
answers
923
views
How to debug ~/.forward
How can I debug `~/.forward` file or see errors logged by mail agent on it **without root privileges**? I'm trying to process my mail with procmail. When I invoke procmail manually with procmail < testMailFile it works as expected (my procmail rule logs input to a file). When no ~/.forward file is p...
How can I debug
~/.forward
file or see errors logged by mail agent on it **without root privileges**?
I'm trying to process my mail with procmail.
When I invoke procmail manually with
procmail < testMailFile
it works as expected (my procmail rule logs input to a file).
When no ~/.forward file is present all mail goes to my default mailbox /var/mail/$USER and ~/.procmailrc **is not processed**.
When I create ~/.forward with:
"|exec /usr/bin/procmail || exit 75"
mail stops coming but .procmailrc
**is still not processed**.
$ lsb_release -a|grep Desc
Description: CentOS release 5.10 (Final)
$ rpm -q exim
exim-4.63-10.el5
Basilevs
(197 rep)
Apr 25, 2014, 09:54 AM
• Last activity: Feb 8, 2024, 10:14 AM
0
votes
1
answers
315
views
In procmail, how can I manipulate a subject line with two MATCH variables?
I am succeeding rewriting my subject line to have a [LIST] prepended to it: :0fhw * ^TO_[^ @ ]+@example\.com\> * ^Subject:\/.+ | /usr/local/bin/formail -I"Subject: [LIST]$MATCH" This succeeds and turns: ```none Subject: here is the subject line ``` into ```none Subject: [LIST] here is the subject li...
I am succeeding rewriting my subject line to have a [LIST] prepended to it:
:0fhw
* ^TO_[^@ ]+@example\.com\>
* ^Subject:\/.+
| /usr/local/bin/formail -I"Subject: [LIST]$MATCH"
This succeeds and turns:
Subject: here is the subject line
into
Subject: [LIST] here is the subject line
ButeI also want to insert the user portion of user@example.com
into the subject line, like this:
Subject: [LIST] user@example.com here is the subject line
... and I don't understand how to do this when I only get one $MATCH
variable!
How can I insert two different variables into the single formail
line that rewrites the subject line?
user227963
(113 rep)
Jan 28, 2024, 06:29 AM
• Last activity: Jan 28, 2024, 08:47 AM
0
votes
1
answers
50
views
Split messages from one inbox to another 2 inboxes based on content
is there a way via Postfix and or procmail for example or another software to forward e-mails from one inbox to another 2 inboxes where each message goes either to one inbox or the other based on content. Sometimes the message is multipart and the keyword is within the first part.
is there a way via Postfix and or procmail for example or another software to forward e-mails from one inbox to another 2 inboxes where each message goes either to one inbox or the other based on content. Sometimes the message is multipart and the keyword is within the first part.
Alexander Petrov
(103 rep)
Dec 6, 2023, 09:36 PM
• Last activity: Dec 7, 2023, 01:25 PM
8
votes
3
answers
5075
views
Restricting who can send to an email address
I'd like to do so that only certain From: addresses can send to an email address (mailing list) on an Ubuntu system running Postfix. Understanding the Postfix the manuals are requires a lot of knowledge, so I'm hoping to get a complete recipe I can use. Currently this is what I have: /etc/postfix/ma...
I'd like to do so that only certain From: addresses can send to an email address (mailing list) on an Ubuntu system running Postfix.
Understanding the Postfix the manuals are requires a lot of knowledge, so I'm hoping to get a complete recipe I can use. Currently this is what I have:
/etc/postfix/main.cf:
smtpd_recipient_restrictions =
check_recipient_access hash:/etc/postfix/protected_destinations
smtpd_restriction_classes = insiders_only
insiders_only = check_sender_access hash:/etc/postfix/insiders, reject
/etc/postfix/protected_destinations:
protected.list@example.com insiders_only
/etc/postfix/insiders:
allowed.user@example.com OK
another.allowed.user@example.com OK
This gives:
fatal: parameter "smtpd_recipient_restrictions": specify at least one working instance of: check_relay_domains, reject_unauth_destination, reject, defer or defer_if_permit
I am open to any suggestions. It doesn't have to be Postfix. It can be procmail or any other standard solution.
Note: the recipient is a mailing list, and thus does not have a user account on the system account. So any solution must work without an account.
### Current mailing list implementation
/etc/postfix/virtual:
protected.list@example.com user1@example.com, user2.example.com, ...
forthrin
(2469 rep)
Jul 12, 2013, 09:15 PM
• Last activity: Aug 26, 2023, 03:07 PM
0
votes
1
answers
1244
views
How to use fetchmail with procmail (or maildrop) on a server running sendmail?
I have *Amazon Linux* instances in *AWS EC2*. They run `sendmail` to communicate with each other, and send outgoing mail through a SMARTHOST that is a commercial email provider. No MX records are pointing to my EC2 instances' public IP addresses, and no incoming mail ports are open. What I really wa...
I have *Amazon Linux* instances in *AWS EC2*. They run
sendmail
to communicate with each other, and send outgoing mail through a SMARTHOST that is a commercial email provider. No MX records are pointing to my EC2 instances' public IP addresses, and no incoming mail ports are open. What I really want is to have a commercial website (goformz.com) send a POST request with a PDF form to my website hosted on these instances
whenever a user submits a form. But until they figure out how to do that, I could work with their current behavior of having them email a PDF attachment to an address on the commercial email server.
After some head-scratching, it looks like I could probably get what I need by installing fetchmail
and either procmail
or maildrop
, no need to touch my sendmail
configuration. And that it "ought" to be very simple. I am familiar with **using** procmail
in a ~/.forward file as a **user**, but installing and configuring it on my EC2 servers is baffling to me after reading the documentation. It looks like both fetchmail
and procmail
want to run as daemons, and hand off messages to other servers. I expected that fetchmail
would run as a daemon, fetching messages from the commercial email account over IMAP at some frequency, and then **synchronously** invoke procmail
on each message, with a rule that was simply to pipe the message to a PHP script that would extract the attachment and process the form fields in it. It would be okay if the script invocation had to be in a ~/.forward file, I would hard-wire the user directory, but I don't see how to set that up. Can anyone set me straight on this, perhaps with just a pointer to documentation that would address this scenario?
I have found other answered questions that look similar, but none that have enlightened me. What I've found seems to assume that the server would be running postfix
as the MTA.
sootsnoot
(101 rep)
Oct 24, 2022, 04:28 PM
• Last activity: Oct 27, 2022, 04:52 AM
8
votes
2
answers
2679
views
How can I test a procmail rule without sending myself an email?
I am getting a lot of spam messages from a certain country. They all have the same pattern in the source. I want to write a procmail rule to automatically move all those emails to my Spam folder. The source of a spam email might look like this ("[REDACTED]" added by me to protect my privacy): ``` Re...
I am getting a lot of spam messages from a certain country. They all have the same pattern in the source. I want to write a procmail rule to automatically move all those emails to my Spam folder.
The source of a spam email might look like this ("[REDACTED]" added by me to protect my privacy):
Return-Path:
X-Original-To: [REDACTED]
Delivered-To: [REDACTED]
Received: from [REDACTED] ([REDACTED] [REDACTED])
by [REDACTED] (Postfix) with ESMTPS id 2AC8E731E799DC
for ; Sat, 9 Jul 2022 20:16:41 +0000 (UTC)
Received: from [REDACTED].org ([REDACTED].ru [REDACTED])
by [REDACTED] (Postfix) with ESMTP id 6F1865ECD8
for ; Sat, 9 Jul 2022 20:16:40 +0000 (UTC)
[...]
What I want to do is look at the "Received" headers and throw everything that comes from .ru TLD into Spam.
My attempt is this:
:0 H
* ^Received:*\.ru
.Spam/
However, I'm new to writing procmail rules. How can I go about testing my new rule so I know it's correct?
RommelTJ
(183 rep)
Jul 10, 2022, 08:39 PM
• Last activity: Jul 12, 2022, 05:35 AM
1
votes
0
answers
52
views
Can procmail intercept incoming messages to a mailing list and modify it before letting it be delivered to the mailboxes of the members of the ML?
I have an email address (a mailing list actually) with a basic procmail setup enabled. Right now, the procmail just dumps incoming emails to fs. I have a use-case where I want to add a custom string to be prepended to each email's body which is received this ML. I've been reading up on procmail for...
I have an email address (a mailing list actually) with a basic procmail setup enabled. Right now, the procmail just dumps incoming emails to fs. I have a use-case where I want to add a custom string to be prepended to each email's body which is received this ML.
I've been reading up on procmail for the past few days and all the answers/examples I see related to modifying email subjects/bodies either explicitly use sendmail to "forward" the modified email or dump the modified email it to a custom mailbox.
What I want is to intercept the message before it is delivered to the ML, prepend some custom text to its body and then let it be delivered to the originally intended ML (i.e. mailboxes of the members of the ML).
Is there a way to achieve this?
Priyansh Agrawal
(119 rep)
Mar 11, 2022, 11:52 AM
• Last activity: Mar 14, 2022, 08:08 AM
1
votes
2
answers
255
views
procmail returning with exit code 0 even if it can't read its config file: How to prevent?
I am dealing with `procmail` the first time, so I apologize if the following question is stupid. Before I put `procmail` in production, I am doing a few basic tests. One of them yielded a totally unexpected result which makes it nearly worthless in my scenario: When `procmail` cannot read its config...
I am dealing with
procmail
the first time, so I apologize if the following question is stupid. Before I put procmail
in production, I am doing a few basic tests. One of them yielded a totally unexpected result which makes it nearly worthless in my scenario:
When procmail
cannot read its configuration file, it nevertheless sets its exit code to 0
(true) when it finishes. This is catastrophic, because in my scenario, I am using procmail
as an MDA which is executed from within fetchmail
. If procmail
can't read its configuration file, it can't process (deliver) messages as needed, but sets exit code 0
when it finishes; fetchmail
interprets this as successful delivery and deletes the respective messages upstream. In summary, this leads to those messages being lost.
The permissions in this scenario are quite complex (fetchmail
+ procmail
+ cyrdeliver
over lmtp
, fetchmail
running under its own user account, procmail
being suid
and setgid
, and so on), so it could very well happen that somebody makes a mistake with the permissions when something needs to be changed. Due to the problem described above, such mistakes likely lead to loss of messages.
Therefore, I'd like to know how to make procmail
to exit with failure (exit code other than 0
) if it can't read its configuration file.
To give an idea what this is about, please consider the following terminal session (irrelevant lines removed). Please note that the ownership / permissions in the config directory are wrong by intention, because this is my test case.
root@morn /etc/fetchmail # whoami
root
root@morn /etc/fetchmail # dir
total 52K
drwx------ 2 fetchmail root 4.0K 2022-01-23 10:09 .
drwxr-xr-x 123 root root 12K 2022-01-22 17:17 ..
-rw------- 1 fetchmail root 2.4K 2022-01-23 10:09 fetchmailrc
-rw------- 1 root mail 282 2022-01-23 02:49 procmailrc
-rw-r--r-- 1 root root 110 2022-01-23 00:36 testmessage
root@morn /etc/fetchmail # dir which procmail
-rwsr-sr-x 1 root mail 92K 2017-11-16 23:42 /usr/bin/procmail
root@morn /etc/fetchmail # cat /etc/systemd/system/pp-fetchmail.service
User=fetchmail
Group=mail
ExecStart=/usr/bin/fetchmail -f /etc/fetchmail/fetchmailrc --pidfile /run/fetchmail/fetchmail.pid --syslog
root@morn /etc/fetchmail # cat fetchmailrc
poll
pop3.example.com
proto pop3
bad-header accept
user "user1@example.com"
ssl
pass "supersecret"
is "user1" here
no rewrite
mda "/usr/bin/procmail TARGET=user1 /etc/fetchmail/procmailrc"
root@morn /etc/fetchmail # cat testmessage
From: nobody@nowhere.com
To: somebody@somewhere.com
Subject: Test message
This is a test message.
root@morn /etc/fetchmail # sudo -u fetchmail -g mail /usr/bin/procmail /etc/fetchmail/procmailrc < testmessage && echo "procmail exited 0"
procmail: Couldn't read "/etc/fetchmail/procmailrc"
procmail exited 0
Of course, the last two lines are the problem. Does anybody know how to circumvent it? Of course, fixing the permissions would make it work correctly, but that is what I'm explicitly not asking for. I'd like to have a solution which is more robust in case of mistakes (mine or others').
Binarus
(3891 rep)
Jan 23, 2022, 10:11 AM
• Last activity: Jan 24, 2022, 07:18 AM
7
votes
2
answers
8747
views
Using Munpack to extract attachments of specific file type (Debian/Squeeze)
I configured `Munpack` on my Debian/Linux to extract attachments from incoming emails. (For additional context, `Getmail` fetches the emails and pipes it to `Procmail`. A `Procmail` recipe then pipes it to `Munpack`.) | munpack -q -C directory/ For some reason, when I get emails with (a) inline atta...
I configured
Munpack
on my Debian/Linux to extract attachments from incoming emails.
(For additional context, Getmail
fetches the emails and pipes it to Procmail
. A Procmail
recipe then pipes it to Munpack
.)
| munpack -q -C directory/
For some reason, when I get emails with (a) inline attachments (usually images
) AND (b) document attachments (usually .csv
), the .csv
files are completely ruined.
_(Note that this issue doesn't arise when there is only one attachment, which typically is a .xls
file._
Is there a way to configure Munpack to:
1. Save **ONLY** attachments with the .csv
extension in the email.
2. Make sure that the **.csv** files are saved as is.
Spartanblogger
(607 rep)
Jan 29, 2013, 08:23 PM
• Last activity: Nov 22, 2021, 11:24 AM
0
votes
1
answers
1393
views
How can I set a simple forwarding procmail rule based on FROM?
Using Procmail, I would like to add a rule that dictates: If any email comes from this specific email address, *in addition to delivering it locally*, also forward it to this other email address. My attempt at this rule is as follows: ``` :0 c: * ^From:.sender@example.com ! recipient@horses.example...
Using Procmail, I would like to add a rule that dictates:
If any email comes from this specific email address, *in addition to delivering it locally*, also forward it to this other email address.
My attempt at this rule is as follows:
:0 c:
* ^From:.sender@example.com
! recipient@horses.example
... but this does not appear to work. In fact, it appears to not do anything.
user227963
(113 rep)
Oct 6, 2021, 06:05 AM
• Last activity: Oct 6, 2021, 05:12 PM
1
votes
1
answers
44
views
Procmail: Send ticket numbers to an address named "ticket@domain"?
I am looking to do the following: 1. User sends an email to `1234@domain` 2. **Procmail recognizes `1234@domain` as an email sent to `ticket+1234@domain`** 3. Procmail recipe handles ticket number and forwards email to the bug tracker Where **bold** is my current obstacle. Here is a proof of concept...
I am looking to do the following:
1. User sends an email to
1234@domain
2. **Procmail recognizes 1234@domain
as an email sent to ticket+1234@domain
**
3. Procmail recipe handles ticket number and forwards email to the bug tracker
Where **bold** is my current obstacle.
Here is a proof of concept. At this point, the user still has to send the ticket to ticket+1234@domain
for the email to forward correctly:
=/bin/bash
SUBJECT=/usr/bin/formail -zx "Subject:"
:0fhw
* To.*\/([0-9]+)@domain
* MATCH ?? ^\/[0-9]+
|/usr/bin/formail -I "Subject: $SUBJECT (Case $MATCH)"
:0
!tickets@bugtracker
**Some context:**
There is one address created, ticket@domain,
for ticket handling. Currently, a user sends to ticket+####@domain
, and the Procmail recipe uses $MATCH
to grab the ticket number that correlates to the bug tracker entry and forwards accordingly. This works.
**What I want to do**:
Prevent auto-completion errors (a user will enter ticket+
in the recipient field, and the wrong ticket # is auto-completed). To prevent these mistakes, a user needs to send an email to ####@domain
_instead_ of ticket+####@domain
.
**The Big Question:**
Can I use Procmail to filter emails from ####@domain
to be treated as emails from ticket+####@domain
?..
Samuel V
(13 rep)
Sep 30, 2021, 03:16 PM
• Last activity: Sep 30, 2021, 06:52 PM
2
votes
1
answers
464
views
What is the meaning of %F, %T, and %s in fetchmail's mda option?
Browsing through web pages around the World Wide Web, I often come across `~/.fetchmailrc` examples such as: ``` poll mail.example.com port 993 proto imap user "max123" password "123456" mda "/usr/bin/procmail -f %F -d %T" ``` What do the `%F` and `%T` mean? Sometimes, I also see `%s`. Where can I f...
Browsing through web pages around the World Wide Web, I often come across
~/.fetchmailrc
examples such as:
poll mail.example.com
port 993
proto imap
user "max123" password "123456"
mda "/usr/bin/procmail -f %F -d %T"
What do the %F
and %T
mean? Sometimes, I also see %s
. Where can I find the documentation of all the available %
options? I have looked at the [fetchmail manual](https://www.fetchmail.info/fetchmail-man.html) , but it doesn't document this.
Flux
(3238 rep)
Mar 6, 2021, 02:13 AM
• Last activity: Mar 6, 2021, 08:49 AM
1
votes
1
answers
411
views
How to run procmail in cmdline and provide .eml file as input?
Procmail failed while running my external python script on received email. After that I tried run that script manually and provide the same arguments as procmail - it passed without any problems, so I'm trying to figure out why procmail had problems with that script. Is is possible to run procmail f...
Procmail failed while running my external python script on received email. After that I tried run that script manually and provide the same arguments as procmail - it passed without any problems, so I'm trying to figure out why procmail had problems with that script. Is is possible to run procmail from cmdline and provide path to saved .eml file with email's raw data? Shall I configure something else, maybe permissions are wrong - but I guess procmail is executed by the same user as I did a manual check on python script.
VIPPER
(115 rep)
Mar 28, 2020, 12:11 PM
• Last activity: Mar 29, 2020, 10:08 AM
0
votes
1
answers
207
views
How to get a filename of copied email by procmail and pass it to a script?
I'm trying to execute script when email arrives my server and pass its filename to that script. First part is done, procmail executes script each time an email arrives. Before executing script it copies email to the specific directory. :0c procmail-dir/ :0 fw | /usr/bin/python3 /home/user/script.py...
I'm trying to execute script when email arrives my server and pass its filename to that script. First part is done, procmail executes script each time an email arrives. Before executing script it copies email to the specific directory.
:0c
procmail-dir/
:0 fw
| /usr/bin/python3 /home/user/script.py
How can I get a filename/path to just saved email in procmail-dir and pass it to a script.py?
VIPPER
(115 rep)
Mar 25, 2020, 09:52 PM
• Last activity: Mar 26, 2020, 05:54 AM
4
votes
3
answers
2498
views
procmail recipe with a regex doesn't work
In my `~/.procmailrc` I have the following lines: :0 \* ^Subject:.*(O|o)pen( \|)(S|s)(onic|urge) $MAILDIR/OpenSurge/ As you see, I would like to put any mail containing “Open Surge” (or any variant with space or capital letters) in the folder OpenSurge. But the messages containing this words only we...
In my
~/.procmailrc
I have the following lines:
:0
\* ^Subject:.*(O|o)pen( \|)(S|s)(onic|urge)
$MAILDIR/OpenSurge/
As you see, I would like to put any mail containing “Open Surge” (or any variant with space or capital letters) in the folder OpenSurge. But the messages containing this words only went to the default folder.
Notice that I have a lot of others recipes with ^From:foo
and when I try ^Subject:.*OpenSurge
my recipe work with “OpenSurge” but I doesn’t work with the regexp ^Subject:.*(O|o)pen( \|)(S|s)(onic|urge)
.
So, how can I match please with a regexp all possibilities of writing “Open Surge”?
fauve
(1529 rep)
Feb 26, 2014, 12:18 AM
• Last activity: Jan 11, 2020, 07:06 AM
0
votes
1
answers
825
views
Invoke procmail on spool file using new .procmailrc?
I've recently configured new `.procmailrc` and `.forward` files to work with our Postfix mail server. I've tested it with new Emails, and the new `.procmailrc` is properly filtering and forwarding as desired. Now I would like to somehow re-process the entire contents of my `/var/spool/mail/***userna...
I've recently configured new
.procmailrc
and .forward
files to work with our Postfix mail server. I've tested it with new Emails, and the new .procmailrc
is properly filtering and forwarding as desired.
Now I would like to somehow re-process the entire contents of my /var/spool/mail/***username***
file using the new .procmailrc
so that all 2000+ messages will be properly sorted into my new ~/mail/Likely-Spam
, ~/mail/Almost-Certainly-Spam
, ~/mail/Cron-Jobs
, ~/mail/Email-Backup
, etc..., and forward all non-filtered messages to my company outlook account... for posterity.
Is there a straightforward command to accomplish this?
My mail server is running RHEL 7 with postfix.
Will
(23 rep)
Oct 22, 2019, 09:05 PM
• Last activity: Oct 23, 2019, 04:28 AM
2
votes
1
answers
3447
views
Forward/Redirect email fetched via fetchmail to gmail
I am on a mac using terminal. I am trying to redirect email from a work email to gmail (the work email only allows IMAP and gmail can only fetch from POP - hence the workaround). I have successfully configured fetchmail to fetch the mail from the work email. I would now like to REDIRECT it to gmail,...
I am on a mac using terminal. I am trying to redirect email from a work email to gmail (the work email only allows IMAP and gmail can only fetch from POP - hence the workaround).
I have successfully configured fetchmail to fetch the mail from the work email.
I would now like to REDIRECT it to gmail, such that when it arrives it appears to arrive from (and I can reply to) the *original* sender.
I have tried both procmail and ssmtp with following configurations. For BOTH, the email does arrive in my gmail inbox however it appears to come from ME myusername@gmail.com rather than the original sender.
Any suggestions? I am *very* new at this. Welcome suggestions using procmail or ssmtp (or if it will work anything else!)
**procmail set up**
.fetchmailrc file:
set no bouncemail
poll outlook.office365.com with protocol imap
port 993
auth password
user user@domain.com password password
ssl
sslfingerprint ""
sslcertpath /Users/myuser/.certs
keep
no rewrite
mda "/usr/local/bin/procmail -f %F -d %T";
.procmailrc file
VERBOSE=yes
:0
! myusername@gmail.com
(with sendmail configured to send from my gmail, as per my answer here: https://unix.stackexchange.com/questions/369842/using-procmail-to-forward-to-gmail/369854#369854)
**ssmtp set up**
/opt/local/etc/ssmtp/ssmtp.conf file
root=FIXME@gmail.com
mailhub=smtp.gmail.com:587
rewriteDomain=
hostname=localhost
UseTLS=Yes
UseSTARTTLS=Yes
AuthUser=FIXME@gmail.com
AuthPass=Hunter2
FromLineOverride=yes
(have also tried without root line, and with rewriteDomain=gmail.com)
.fetchmailrc file, same as above except mda line is now:
mda "/opt/local/sbin/ssmtp FIXME@gmail.com"
Amanda
(33 rep)
Jun 9, 2017, 03:41 PM
• Last activity: Oct 4, 2019, 08:02 PM
Showing page 1 of 20 total questions