Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
The body of email includes the Headers and the Body Text. Do you want headers included (without those, you don't see things like From:, Subject:, Date:, etc.
The body of email is often mime encoded, and just truncating will likely not give you the results you want. Only for plain text (non-mime encoded) mail will the results be generally useful.
I'm making a poor man's blackberry... I get unlimited incoming text messages on my phone. I'm limited at 160 characters per message and I really don't want to get multi-part messages for long emails. I just mainly want to snag the subject and what else will fit from the body till the 160 limit. It all goes back out via ISP's SMTP server (my cell company gives me an email address to send me text msg's).
Hopefully that will help figure out what I'm doing
Yeah, I figured I'd need to call an app... hoping I wouldn't need to write one in perl or something... I can do some bash scripting but I haven't don't much perl yet. My past experience says Perl and I don't get along
Thinking about whipping up a procmail recipe: given a single e-mail message, then piping it through 'formail -k -X Subject:' will strip off all headers except the subject, then piping it through 'xargs' will give you one space separated string, then piping it through cut will cut it off at $charcount (rather than using string=${string:0:169}, then stripping string=${string//Subject: /} will give you the whole onehundredandsixty chars to e-mail back out. Could be a very small shell script.
Thinking about whipping up a procmail recipe: given a single e-mail message, then piping it through 'formail -k -X Subject:' will strip off all headers except the subject, then piping it through 'xargs' will give you one space separated string, then piping it through cut will cut it off at $charcount (rather than using string=${string:0:169}, then stripping string=${string//Subject: /} will give you the whole onehundredandsixty chars to e-mail back out. Could be a very small shell script.
Right, but this isn't the issue. The issue is that the first portion of the body of an email can be all MIME headers and sections. For example:
Code:
This is a multi-part message in MIME format.
------=_NextPart_000_0006_01C8E011.A194AB80
Content-Type: text/plain;
charset="iso-8859-2"
Content-Transfer-Encoding: 7bit
This is 170 characters. It is not until *after* those headers is there anything interesting:
Code:
Good evening.
Wanted!
But it may not be that way either. The text/plain portion could be at the end of the mime encapsulation, and one might end up with this:
Clearly I read over the "that being not the issue" part. Still should be doable either using some procmail recipe from here or here or your "stripper app" as you already suggested.
Clearly I read over the "that being not the issue" part. Still should be doable either using some procmail recipe from here or here or your "stripper app" as you already suggested.
I read through all that and then come across the last part of that first page which is EXACTLY what I'm doing! Granted I still need to research it more as I don't really get how it all goes together and I want to do some crazy stuff where I can query a database via a text message sent to my email... so I'll need to learn more about how to decode the body and recognize "commands" to do that with.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.