Sponsored Content
Top Forums Shell Programming and Scripting Split email message with procmail Post 302821455 by DGPickett on Friday 14th of June 2013 02:17:42 PM
Old 06-14-2013
You want to forge a remote sender? I just wanted a recipient and subject.

In my experience, a time stamp somewhere in the subject is nice, for selecting email by subject, perhaps for sorting, too, "<General_topic>-Hostname-YYYY-MM-DD_HH:MM".

So, in awkish, you need to collect all lines of the block in a body variable and collect bits for the subject and recipient in two or more variables, and the after collecting the Created line, spit out the mail command and input data and maybe clean your variables. Or you can clear your variables on the first line of the block. If your recipient variable ends up empty, you might want to send to a default address with a 'DefectiveBlock:' prefixed subject.

Last edited by DGPickett; 06-14-2013 at 03:24 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

email attachment, with a message using mailx

Hi, I am trying to include a message along with an attachment with an email using mailx on AIX. uuencode Test.dat Test.dat| mailx -s 'Testing' mymail@yahoo.com < MESGFILE This only gives me the contents of MESGFILE as my message. If I remove the < FILE I recieve the attachment. What... (4 Replies)
Discussion started by: edog
4 Replies

2. UNIX for Dummies Questions & Answers

Split-Email-removing files

Friends, I have a datafile that have unknown a number of CHARACTERS. if the datafile have more than 1 character and less than 20 email me the file rm datafile if the datafile have more than 20 characters split the datafile into 20 characters in each file email datafileaa email... (4 Replies)
Discussion started by: bobo
4 Replies

3. UNIX for Dummies Questions & Answers

Procmail 3.22 install error message

I'm trying to install : Procmail 3.22 onto a : E10K domain running : Solaris 2.6 Generic_105181-35 I untar the file to /stage/procmail-3.22. When I run the command: /usr/ccs/bin/make install I get the following message, then the install aborts: License Error : Cannot find license... (2 Replies)
Discussion started by: antalexi
2 Replies

4. Shell Programming and Scripting

error-when trying to send the message thru email.

Hi All, I want to send a message through email. I have written below code. But it is not worling. Anybody has idea, why it is not working?. export $file1=$home1/pip1.$$ mailx -s "This Message from unix" abc@yahoo.com< $file1 thanks,Mary. (5 Replies)
Discussion started by: MARY76
5 Replies

5. Shell Programming and Scripting

how to send contents of a file to email as a message

i have a file new1.txt i want to send the contents of that file as a message to email ali@sms.com i m using ksh script......... plz help me (5 Replies)
Discussion started by: ali560045
5 Replies

6. Shell Programming and Scripting

Email alert doesnt contain any message

I have created a script which will monitor disk space in unix, it will send an email alert that will notify the specified receipients. I used echo in the mailx command but the email doesnt contain any message. I have used printf to store the message ($message2) and when tried to display on the... (2 Replies)
Discussion started by: lscanaleta
2 Replies

7. UNIX for Dummies Questions & Answers

How to get failure notice message when email is not sent.

I am using mailx command to send emails from the Unix command prompt. Whenever email is not sent it is not giving me any message "Email not sent" or failure delivery notice for the wrong email addresses. When I give correct email address I am able to receive them correctly. Can anyone please... (0 Replies)
Discussion started by: szc0025
0 Replies

8. UNIX and Linux Applications

Ssmtp -t < /path/to/the/message.txt (How to format message.txt for html email)

ssmtp has been running well under Kubuntu 12.04.1 for plain text messages. I would like to send html messages with ssmtp -t < /path/to/the/message.txt, but I cannot seem to get the message.txt file properly formatted. I have tried various charsets, Content-Transfer-Encoding, rearranging the... (0 Replies)
Discussion started by: Ronald B
0 Replies

9. Shell Programming and Scripting

Message Body while sending an email

I am making use of the following code to display the results of my txt file in an email: mail -s 'Count Validation Test Comparison Results' Ronit@XYZ.com < Count_Validation_Results_`date +%m%d%Y`.txt Email Output: ----------Query 1 Count Validation Results-------- Source count is 4 Target... (7 Replies)
Discussion started by: ronitreddy
7 Replies
LOCKFILE(1)						      General Commands Manual						       LOCKFILE(1)

NAME
lockfile - conditional semaphore-file creator SYNOPSIS
lockfile -sleeptime | -r retries | -l locktimeout | -s suspend | -! | -ml | -mu | filename ... DESCRIPTION
lockfile can be used to create one or more semaphore files. If lockfile can't create all the specified files (in the specified order), it waits sleeptime (defaults to 8) seconds and retries the last file that didn't succeed. You can specify the number of retries to do until failure is returned. If the number of retries is -1 (default, i.e., -r-1) lockfile will retry forever. If the number of retries expires before all files have been created, lockfile returns failure and removes all the files it created up till that point. Using lockfile as the condition of a loop in a shell script can be done easily by using the -! flag to invert the exit status. To prevent infinite loops, failures for any reason other than the lockfile already existing are not inverted to success but rather are still returned as failures. All flags can be specified anywhere on the command line, they will be processed when encountered. The command line is simply parsed from left to right. All files created by lockfile will be read-only, and therefore will have to be removed with rm -f. If you specify a locktimeout then a lockfile will be removed by force after locktimeout seconds have passed since the lockfile was last modified/created (most likely by some other program that unexpectedly died a long time ago, and hence could not clean up any leftover lock- files). Lockfile is clock skew immune. After a lockfile has been removed by force, a suspension of suspend seconds (defaults to 16) is taken into account, in order to prevent the inadvertent immediate removal of any newly created lockfile by another program (compare SUSPEND in procmail(1)). Mailbox locks If the permissions on the system mail spool directory allow it, or if lockfile is suitably setgid, it will be able to lock and unlock your system mailbox by using the options -ml and -mu respectively. EXAMPLES
Suppose you want to make sure that access to the file "important" is serialised, i.e., no more than one program or shell script should be allowed to access it. For simplicity's sake, let's suppose that it is a shell script. In this case you could solve it like this: ... lockfile important.lock ... access_"important"_to_your_hearts_content ... rm -f important.lock ... Now if all the scripts that access "important" follow this guideline, you will be assured that at most one script will be executing between the `lockfile' and the `rm' commands. ENVIRONMENT
LOGNAME used as a hint to determine the invoker's loginname FILES
/etc/passwd to verify and/or correct the invoker's loginname (and to find out his HOME directory, if needed) /var/spool/mail/$LOGNAME.lock lockfile for the system mailbox, the environment variables present in here will not be taken from the environment, but will be determined by looking in /etc/passwd SEE ALSO
rm(1), mail(1), binmail(1), sendmail(8), procmail(1) DIAGNOSTICS
Filename too long, ... Use shorter filenames. Forced unlock denied on "x" No write permission in the directory where lockfile "x" resides, or more than one lockfile trying to force a lock at exactly the same time. Forcing lock on "x" Lockfile "x" is going to be removed by force because of a timeout (compare LOCKTIMEOUT in procmail(1)). Out of memory, ... The system is out of swap space. Signal received, ... Lockfile will remove anything it created till now and terminate. Sorry, ... The retries limit has been reached. Truncating "x" and retrying lock "x" does not seem to be a valid filename. Try praying, ... Missing subdirectories or insufficient privileges. BUGS
Definitely less than one. WARNINGS
The behavior of the -! flag, while useful, is not necessarily intuitive or consistent. When testing lockfile's return value, shell script writers should consider carefully whether they want to use the -! flag, simply reverse the test, or do a switch on the exact exitcode. In general, the -! flag should only be used when lockfile is the conditional of a loop. MISCELLANEOUS
Lockfile is NFS-resistant and eight-bit clean. NOTES
Calling up lockfile with the -h or -? options will cause it to display a command-line help page. Calling it up with the -v option will cause it to display its version information. Multiple -! flags will toggle the return status. Since flags can occur anywhere on the command line, any filename starting with a '-' has to be preceded by './'. The number of retries will not be reset when any following file is being created (i.e., they are simply used up). It can, however, be re- set by specifying -rnewretries after every file on the command line. Although files with any name can be used as lockfiles, it is common practice to use the extension `.lock' to lock mailfolders (it is ap- pended to the mailfolder name). In case one does not want to have to worry about too long filenames and does not have to conform to any other lockfilename convention, then an excellent way to generate a lockfilename corresponding to some already existing file is by taking the prefix `lock.' and appending the i-node number of the file which is to be locked. SOURCE
This program is part of the procmail mail-processing-package (v3.22) available at http://www.procmail.org/ or ftp.procmail.org in pub/proc- mail/. MAILINGLIST
There exists a mailinglist for questions relating to any program in the procmail package: <procmail-users@procmail.org> for submitting questions/answers. <procmail-users-request@procmail.org> for subscription requests. If you would like to stay informed about new versions and official patches send a subscription request to procmail-announce-request@procmail.org (this is a readonly list). AUTHORS
Stephen R. van den Berg <srb@cuci.nl> Philip A. Guenther <guenther@sendmail.com> BuGless 2001/06/23 LOCKFILE(1)
All times are GMT -4. The time now is 08:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy