mailx command with headers


 
Thread Tools Search this Thread
Operating Systems Solaris mailx command with headers
# 1  
Old 02-06-2006
mailx command with headers

I am having trouble with the mailx command. I have looked many places but can't find the answer.

A user at work wants his application to send an email with the Outlook Importance set to high.

It looks like I need to modify the MIME headers in order to accomplish this.

Is this possible using the mailx command?
# 2  
Old 02-08-2006
See this thread
Maybe Reborg can give an example?

(And next time, try the Search utility)
# 3  
Old 02-08-2006
But I DID do a search. That thread wasn't helpful.

I still haven't found a solution I can use on Solaris yet. I may try to do something directly with sendmail using perl.

Any sendmail examples using perl would be a great help.

Thanks!
# 4  
Old 02-08-2006
OK. Here's the solution I found using perl (this is a modification of a script I found through Google)...


#!/usr/bin/perl

unless(open (MAIL, "|/usr/lib/sendmail -t")) {
print "error.\n";
warn "Error starting sendmail: $!";
}
else{
print MAIL "From: myemail\@mydomain.com\n";
print MAIL "To: myemail\@mydomain.com\n";
print MAIL "Importance: High\n\n";
print MAIL "Subject: test subject\n\n";
print MAIL "test mail message";
close(MAIL) || warn "Error closing mail: $!";
print "Mail sent.\n";
}


Also, Make sure the path to your sendmail is correct.

Last edited by rgremill; 02-08-2006 at 11:33 AM..
# 5  
Old 02-09-2006
Quote:
Originally Posted by rgremill
But I DID do a search. That thread wasn't helpful.

I still haven't found a solution I can use on Solaris yet. I may try to do something directly with sendmail using perl.
It is interesting that you say it the thread indicated to you was not helpful, since what I suggested in the other thread is exactly what you did in the end.

RTM: Sure thing, I had meant to post in the other thread at the time, but forgot to update my post:

It can actually be as simple as:

Code:
(echo "Importance: High" ; cat /my_mail_file) | /usr/lib/sendmail someuser@somewhere.com

# 6  
Old 02-09-2006
reborg,

I take that back. It was ultimately helpful.

It was unhelpful with regard to the mailx question, which I was still trying to use at the time I wrote that post.

But it was VERY HELPFUL because of the sendmail hint.

Hopefully this thread will help others now that the sendmail example is included.

Thanks for your sendmail hint and example!

Robert

Last edited by rgremill; 02-09-2006 at 05:51 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Curl command to post headers

I am trying post SOAP header from file to curl command. The curl command is curl -vk -H "$(cat curl-test1.txt)" -X POST https://xvcfvusdgfsd.sdfjd.gf/cmsws/CMSService The contet of curl file is POST: https://cmsuat.chrysler.com/cmsusws/CMSService HTTP/1.1 SOAPAction:... (1 Reply)
Discussion started by: dineshaila
1 Replies

2. Shell Programming and Scripting

Faster command to remove headers for files in a directory

Good evening Im new at unix shell scripting and im planning to script a shell that removes headers for about 120 files in a directory and each file contains about 200000 lines in average. i know i will loop files to process each one and ive found in this great forum different solutions... (5 Replies)
Discussion started by: alexcol
5 Replies

3. Red Hat

Mailx command

Using RHEL 5.5 New to using 'mailx' Was trying to check if mailx is configured. mailx command gives a list of unread mails. Now I tried to send mail using this command to a local or on network machine using mailx -s "Test2" "root@<servername>" But did not receive any message. (6 Replies)
Discussion started by: ikn3
6 Replies

4. UNIX for Dummies Questions & Answers

Using sed command to remove multiple instances of repeating headers in one file?

Hi, I have catenated multiple output files (from a monte carlo run) into one big output file. Each individual file has it's own two line header. So when I catenate, there are multiple two line headers (of the same wording) within the big file. How do I use the sed command to search for the... (1 Reply)
Discussion started by: rebazon
1 Replies

5. Solaris

mailx command

Dear all, Every time if i use mailx it is asking for entering the From Address. I want to set it in some place, So that it will take it by default whenever we send mails. Pl help on this. Regards JeganR (2 Replies)
Discussion started by: jegaraman
2 Replies

6. Shell Programming and Scripting

Mailx: How to send a attachment using mailx command

Hi All, Can anyone please provide the command for sending an mail with attachment using mailx command. Thanks in Advance :) Regards, Siram. (3 Replies)
Discussion started by: Sriram.Vedula53
3 Replies

7. Shell Programming and Scripting

Merging of files with different headers to make combined headers file

Hi , I have a typical situation. I have 4 files and with different headers (number of headers is varible ). I need to make such a merged file which will have headers combined from all files (comman coluns should appear once only). For example - File 1 H1|H2|H3|H4 11|12|13|14 21|22|23|23... (1 Reply)
Discussion started by: marut_ashu
1 Replies

8. Shell Programming and Scripting

Mailx command

Hi, This post is regarding sending mails from Unix. How can we include "bcc" in a "mailx" command. I searched google to find out the -b option; but my man pages doesnot show that option(it throws me an error: "-b not found"). It has a "~b" option but i am not sure how to use it. Could you people... (2 Replies)
Discussion started by: Thumban
2 Replies

9. Shell Programming and Scripting

Remove text between headers while leaving headers intact

Hi, I'm trying to strip all lines between two headers in a file: ### BEGIN ### Text to remove, contains all kinds of characters ... Antispyware-Downloadserver.com (Germany)=http://www.antispyware-downloadserver.c om/updates/ Antispyware-Downloadserver.com #2... (3 Replies)
Discussion started by: Trones
3 Replies

10. UNIX for Dummies Questions & Answers

Remove certain headers using mailx or sendmail

Hello, So i want to send mails in any way from a solaris 5.8 system, perhaps using mailx or sendmail. My purpose is to stay clear of systems name in head data. So i want to strip at least the "Message-Id" and the "Recieved" headers of the mail. Yet this seems to be a bit of a problem. Now i... (2 Replies)
Discussion started by: congo
2 Replies
Login or Register to Ask a Question