LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-23-2006, 10:35 AM   #1
stlouis
Member
 
Registered: Jul 2006
Location: Sault Ste. Marie, Ontario
Distribution: RedHat, CentOS, Fedora Core, Gentoo, Slackware
Posts: 63

Rep: Reputation: 16
Sendmail Question


Hi Everyone,

I just have a quick question with regards to using sendmail.

I currently use the following sendmail command to read mail
headers from a file as oppose to specifying them via the command line:

sendmail -t < mailfile

The mailfile contains something like:

From: root
To: user@domain.com
Subject: Mail Subject
Other header info here if desired...

This is the message body.


This works fine, no problems here.

Now, what I want to know is can I use the sendmail command to read and split an appended file into multiple emails, going to different users..

For example, if I had an appended file that looked like:

From: root
To: user@domain.com
Subject: Mail Subject
Other header info

Message body.

From: root
To: otheruser@domain.com
Subject: Mail Subject

Different message body


Would it be possible to use the sendmail command to split/parse the appended file into multiple emails... I tried using a "." on a seperate line by itself after the first Message body, but it doesn't work, it sends one email to the first To: address it comes across...

I've also tried using EOF after the first message body, but that didn't work...

Any ideas, or help would be much appreciated... I'm trying to get batch emailing working...

Thanks in advance.
 
Old 08-23-2006, 08:45 PM   #2
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
You can use formail:
Code:
cat mailfile | formail -ds /usr/sbin/sendmail -t
 
Old 08-24-2006, 07:54 AM   #3
stlouis
Member
 
Registered: Jul 2006
Location: Sault Ste. Marie, Ontario
Distribution: RedHat, CentOS, Fedora Core, Gentoo, Slackware
Posts: 63

Original Poster
Rep: Reputation: 16
Hi Berhanie,

I have not heard of the formail utility before. I am currently using SCO OpenServer UNIX as my Operating System.

Do you know where I can go and download this package? I've found info on the net about the command, but only man pages and short howto's... I have no idea where to get this download.


Thanks,

Jeff
 
Old 08-24-2006, 08:11 AM   #4
stlouis
Member
 
Registered: Jul 2006
Location: Sault Ste. Marie, Ontario
Distribution: RedHat, CentOS, Fedora Core, Gentoo, Slackware
Posts: 63

Original Poster
Rep: Reputation: 16
Hi Berhanie,

I've figured out it was part of the Procmail package... Thank again...

Your help was much appreciated...
 
Old 08-24-2006, 08:20 AM   #5
stlouis
Member
 
Registered: Jul 2006
Location: Sault Ste. Marie, Ontario
Distribution: RedHat, CentOS, Fedora Core, Gentoo, Slackware
Posts: 63

Original Poster
Rep: Reputation: 16
Hi Berhanie,

One last question for you... The Formail works great to split up the file, however, all the header information shows up at the beginning of the email body...

And when I open Outlook to view the emails, for some reason, nothing shows up in the To: or Subject: fields... Those fields do however show up at the top of my email body.

Is there a way to remove the header information from the body of the email?
 
Old 08-26-2006, 08:57 PM   #6
Berhanie
Senior Member
 
Registered: Dec 2003
Location: phnom penh
Distribution: Fedora
Posts: 1,625

Rep: Reputation: 165Reputation: 165
I piped your sample mailfile to formail and had no problems with headers running into the body.

Quote:
Is there a way to remove the header information from the body of the email?
You're barking up the wrong tree. Try figuring out what's going wrong (e.g. mis-formatted mailfile).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on Sendmail itgl72 Linux - Newbie 4 04-13-2005 08:54 AM
SendMail Question? gsmonk Linux - Networking 2 02-18-2004 07:05 AM
Sendmail question WeNdeL Linux - Software 0 12-11-2003 09:06 AM
RH Sendmail Question monte Linux - Distributions 8 06-15-2003 12:17 PM
sendmail question ..... purpleburple Linux - General 1 10-16-2002 01:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration