LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 10-13-2006, 11:43 AM   #1
ThisGuyIKnow
Member
 
Registered: Mar 2006
Posts: 43

Rep: Reputation: 15
Forcing Email Message Body Inline, Not Attached


I couldn't decide which forum to put this into, so please forgive me if it should've been put into a different, more appropriate one.

I have inherited a cgi script that mails a question and user info to one of our librarians here where I work. The problem is that half the time the message body is in an attachment instead of an "inline" regular email.

I don't know where this setting (attached or inline) is controlled and I don't know why it isn't the same every time. The cgi program mails via the system mail program, mail, which is actually a link to the "improved" linux nail program. I looked at the man page for nail and couldn't find anything that would control this. My MTA is Sendmail and I couldn't find anything in the config to control this either. The email client the librarian is using is Novell Groupwise WebAccess (a browser/webmail interface like hotmail). I can't imagine it would be controlled with that.

I made myself a test cgi script to play around with this. To start with, I made it email exactly the same way as the other script and to the same address. For some reason, my test script will email inline every time! I even put the test script in the same directory and gave it the same ownership and permissions as the other script, but I still can't get the other script to email inline every time!

The code (emailing part) is basically as follows:

#!/usr/bin/perl
$mailprog = "/usr/bin/mail -r $emailaddress -s Question";
$recipient = 'librarian@someschool.edu'
open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!\n";
print MAIL "Some message text\n\n";
close (MAIL);

Any ideas?
 
Old 10-15-2006, 07:24 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,140
Blog Entries: 54

Rep: Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791
Interesting. AFAIK the complete message (headers, body and any attachments) has to be defined before or on submitting it to the receiving MTA. Maybe the script has some (il)logic to determine *when* a message should contain an attachment (maybe post a D/L loc for the script for people to check?) and what type of attachment that would be. Your troubleshooting is OK (looking at all different aspects) but you haven't show any test results with a different MUA to see if that matters. Also I would pick three random messages that have attachments and three that don't and see if you can spot any similarities that could cause it to have attachments. BTW, what's the type of the attachment? And if all attachments are essentially plaintext you could add a procmail delivery recipe to change the disposition from say "application/x-octetstream" to "plain/text". That rule should only work for the test address with only the test subject and only if the attachment matches your filter.
 
Old 10-16-2006, 05:22 PM   #3
ThisGuyIKnow
Member
 
Registered: Mar 2006
Posts: 43

Original Poster
Rep: Reputation: 15
Quote:
Interesting. AFAIK the complete message (headers, body and any attachments) has to be defined before or on submitting it to the receiving MTA.
Yep, you're right. I finally contacted someone from a Nail listserv who instructed me to put the following 2 things in my system mail.rc file:

1. set maximum-unencoded-line-length=950
2. set contenttype-cntrl=text/plain

Apparently nail will make the message attached if lines are too long or if they have certain special characters. The above mail.rc directives addresses these respectively.

Thanks unSpawn. Good ideas. And my troubleshooting isn't where it used to be when I was a CS major. I've developed a few bad habits.

- Gavin
 
Old 10-16-2006, 06:45 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,140
Blog Entries: 54

Rep: Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791
I finally contacted someone from a Nail listserv
Shame you took the easy way out though ;-p


my troubleshooting isn't where it used to be when I was a CS major.
Well, like I said before, I think your posted TS was nothing to apologise for.
Thanks for posting the fix.
 
Old 10-17-2006, 12:56 PM   #5
ThisGuyIKnow
Member
 
Registered: Mar 2006
Posts: 43

Original Poster
Rep: Reputation: 15
Heh heh. Yeah, I have so much on my plate right now that I need to get some of these things out of the way, even if it means taking the easy (quick), and less "fun", way out.

Glad to share my , when I can.
 
  


Reply

Tags
attachment, email, inline, mail, sendmail


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract body message from raw e-mail rigel_kent Programming 2 06-03-2006 06:07 AM
Thunderbird prints headers OK but message body corrupt Mq2004 Linux - Software 1 04-10-2006 02:52 PM
GUI email client which forwards mail inline ptrbee Linux - Newbie 2 05-11-2004 09:41 AM
SMTP logging without including the body of the message jspencereds Linux - Networking 0 04-09-2004 11:33 AM
KMail: execute command depending on message body linuxfond Linux - Newbie 0 01-31-2004 07:30 AM


All times are GMT -5. The time now is 11:25 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration