Sponsored Content
Full Discussion: Email formatting
Top Forums Shell Programming and Scripting Email formatting Post 42869 by Optimus_P on Wednesday 5th of November 2003 06:01:58 PM
Old 11-05-2003
this is from one of the guys off the chicago perl mailing lists.

Code:
you might want to take a
look at Mail::Box [2] on CPAN. Once you've got installed you can interact with 
all sorts of mail folders (mbox, maildir, imap4, pop) with a common interface.

Assuming you've got an mbox format file at /home/bgates/mbox, you could:

    use Mail::Box::Mbox;

    my $folder = Mail::Box::Mbox->new( folder => '/home/bgates/mbox' );

    foreach my $msg ( $folder->messages() ) { 
	print $msg->body(),"\n";
    }

Lazy, and nice to read -- at least for me :) You can do all sorts of 
crazy stuff like deleting, modifying, searching. Well worth a look at
if you need to do lots of work with mail messages.

//Ed


Last edited by Optimus_P; 11-06-2003 at 01:30 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies

2. UNIX for Dummies Questions & Answers

Send email where # is in the email address - Using Unix

Hi All, How do I send an email using malix where email address contains a #. I have a email address like this : #test@test.com I want to send email like malix -s "TEST" #test@test.com < SOMEFILE I tried \# but doesn't work. Please let me know how we can achieve this? I am in... (1 Reply)
Discussion started by: jingi1234
1 Replies

3. Solaris

Send an email from Solaris using Linux email server

Hello everyone I have a problem and I need your help: I have a Solaris 10 and Solaris 8 UNIX Servers, and Linux Centos4 as email server. I need send an email from Solaris servers preferably using Centos4 email server. I have no mail service configured in my Solaris computers (1 Reply)
Discussion started by: aflores
1 Replies

4. UNIX for Dummies Questions & Answers

new to ldap, send email to a ou or group, and see a list from email client

hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version). i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010). a. i cant see a list of the contacts,... (0 Replies)
Discussion started by: V4705
0 Replies

5. Shell Programming and Scripting

Using top command to email if process is exceeding 25% and sending an email alert if so

This is my first time writing a script and Im having some trouble, Im trying to use the top command to monitor processes and the amount of CPU usage they require, my aim is to get an email if a process takes over a certain percentage of CPU usage I tried grep Obviosly that hasnt worked, Any... (8 Replies)
Discussion started by: jay02
8 Replies

6. Windows & DOS: Issues & Discussions

email from *nix to Exchange - text formatting issue

Oracle Linux 5.6 x-86-64 (Red Hat derivitive) I have several shell scripts that capture output to a log file, then use that log file as the source of an email. For a very simplified example: echo Today is `date` >> $logfile /bin/mail -s "$subject" "$sendto" < $logfile (yes, $subject... (6 Replies)
Discussion started by: edstevens
6 Replies

7. Shell Programming and Scripting

[Solved] Sending a HTML email from cli loses formatting.

Hi, I have a .sh file, to email a report of our backups from a linux machine. It looks like this (minus a few bits): echo "HELO $host.$domain" sleep 1 echo "mail from: vdrreport@$domain" sleep 1 echo "rcpt to:$mailto" sleep 1 echo "data" sleep 1 echo "subject: $host VDR-Report... (2 Replies)
Discussion started by: cognito
2 Replies

8. UNIX for Dummies Questions & Answers

Formatting The Email Output

Hello All, When i use the single quotes around the variables i am getting each line in the array as seperate in the email as shown in code2 & output2. But i don't want those single quotes to be printed but each array element should be printed as seperate line as when i remove those single quotes... (1 Reply)
Discussion started by: Ariean
1 Replies

9. UNIX for Dummies Questions & Answers

Email formatting gets disturbed because of screen resolution

Hi friends, I have written a shell script which send a report to email address everyday. The report is generated on UNIX server every day, Generated report is sent to 25 users through cron. All 25 users have set different screen resolution for their monitor. The email looks wel formatted for... (4 Replies)
Discussion started by: Nakul_sh
4 Replies

10. Shell Programming and Scripting

Getting email output in single line with out space in email

I have tried below email method and i am getting every thing in single line . i have put echo to provide space, but it is not helping my code ( echo "From: $FROM" echo "To: $MAILTO" echo "CC: $CC" echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo 'Content-Type: multipart/mixed;... (6 Replies)
Discussion started by: mirwasim
6 Replies
INCM(1) 						      General Commands Manual							   INCM(1)

NAME
incm - Incorporating new mails for Mew SYNOPSIS
incm [options] DESCRIPTION
The incm utility incorporates new mails from the mbox or the maildir to Mew's inbox folder. The options are as follows: -a Retrieve all mails from maildir/{cur,new} for maildir. -b Backup mails. mbox: No truncate mbox file. maildir: To maildir/cur directory. -c Use the Content-Length: field, instead of the "From " line, as a mail separator for mbox. -d path Path to mbox/maildir. If path is a file, mbox is assumed. If path is a directory, maildir is assumed. -m path The same as the -d option. -s Read one mail from stdin instead of mbox/maildir. -i inboxdir A path to the inbox directory. -u Don't touch ".mew-mtime". -f Preserve Unix From (Envelope Sender) line in mbox case. -p mode Specify file mode that creates in mbox case. -o Use the suffix when creating messages. -x suffix Use this suffix. -h Display this help message. -v Display the version. mbox For mbox, the mail separator is "From " in the beginning of lines. The incm utility does not convert ">From " to "From " in the beginning of lines in the body. On Solaris, Content-Length: should be used with the -c option to tell the end of mail. To lock mbox, a lock file("<user>.lock"), flock() or lockf(), and open(O_EXLOCK) are used. maildir For maildir, no lock and no separator are necessary. Consider the following situation: cur/{1,2} new/{3,4} Executing incm without the options results in: cur/{1,2} new/{} to inbox: {3,4} Executing incm with the -a option results in: cur/{} new/{} to inbox: {1,2,3,4} Executing incm with the -b option results in: cur/{1,2,3,4} new/{} to inbox: {3,4} Executing incm with the -a option and the -b option results in: cur/{1,2,3,4} new/{} to inbox: {1,2,3,4} So, if both options are specified, messages are retrieved multiple times. December 25, 2001 INCM(1)
All times are GMT -4. The time now is 10:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy