send mail file from server to another address


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers send mail file from server to another address
# 1  
Old 12-09-2008
send mail file from server to another address

HP-UX B11.23 ia64

I have a users mail inbox in /var/mail
I want to send all the mail there to another address (an Exchange address).
At the Exchange address, I want it to appear as the original separate emails, with attachments in their original form (e.g. still MIME encoded).

Is that possible, and if so how?

Lisa
# 2  
Old 12-09-2008
not a bump but to supply more information -

I did try reading the mail as with mailx -f or mail and then tried to send the output (the mail itself) to mailx with the destination of the other user but that didn't work - or it didn't work in a timely manner so I cntl-C
but that is the kind of thing I'm trying to do.
# 3  
Old 12-09-2008
You'll probably want to write a script to parse the mbox files and then send each. I've done that in the past, but I don't remember specifics. I believe that each message begins with "^From", so you could start by trying to parse along those lines. If you know if, perl would be a good tools for this job.

Good luck!
# 4  
Old 12-09-2008
hmm - that sounds as if it would work for instream messages but I'm not sure attachements would look like attachments at the target. Thanks for the idea.
# 5  
Old 12-09-2008
Since the attachments are stored inline, it shouldn't make a difference. I'd recommend a test, of course, but since they'll get delivered via smtp to the desired target, the recipient won't be any the wiser.
# 6  
Old 12-09-2008
I found the script

#!/bin/perl -w

#########################################
#split_mbox.pl
#
#This script is desined to split an mbox
#file into individual message files.
#########################################

my $infile="/path/to/infile";
my $outdir="/path/to/outdir";
my $fcnt=1;
my @fcontents;

open(INFILE, "$infile") || die "Can't open $infile: $!";
@fcontents=<INFILE>;
close(INFILE);

foreach $line(@fcontents) {
my $outfile="$outdir/$fcnt";
print "$outfile\n";
if($line =~ /^From /) {
print "$line\n";
close(WRITE);
$fcnt++;
$outfile="$outdir/$fcnt";
open(WRITE, ">$outfile") || die "Can't open $outfile: $!";
print WRITE $line;
} else {
print WRITE $line;
}
}


Use it or not, as you like...Smilie
# 7  
Old 12-09-2008
very interesting - we'll see if we can adapt for our purpose
thanks
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

How to send mail with sender mail address and name?

Hi, I am trying to send a mail using "mail" command in unix. I wanted to give sender name and sender address. I tried different options ,but still it shows only mail address(No name). mail -s "Alert mail : Nothing running !!!" $email -- -F"Mail Alert" -fno-reply@alert.com But I am getting... (4 Replies)
Discussion started by: jaggy
4 Replies

2. Shell Programming and Scripting

How to send mail using PHP mail function On apache server.?

Hello, I am using centos-6.2 I have apache server,php5 on my system and I want to send mail using sendmail on my system. when I try to send mail from shell that time mail is succesfully sent to respective address() but when I try to send it through webbrowser I am not able to send it.... (1 Reply)
Discussion started by: Kiran ursal
1 Replies

3. UNIX for Advanced & Expert Users

How can I send a mail from my outlook or other mail accounts to UNIX server?

Hi all, I want to send a mail for my business needs from outlook account to an unix server (HP-UX) but I don't send any mail. While I can send from the unix server to my outlook account, I can't send from outlook to unix. How can I achieve this ? How can I send a mail from my outlook or other... (2 Replies)
Discussion started by: igelegin
2 Replies

4. Shell Programming and Scripting

How i can send a mail from outlook to an UNIX server?

Hi all, I want to send a mail for my business needs from outlook account to an unix server (HP-UX) but I don't send any mail. While I can sent from the unix server to my outlook account,I can't send from outlook to unix. How can I achieve this ? How can I send a mail from my outlook or other... (5 Replies)
Discussion started by: igelegin
5 Replies

5. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

6. UNIX for Dummies Questions & Answers

How to send html file in a mail not as an attachment but it should display in the mail in table for

Hi The below script working when we are sending the html as attachment can u please guide how to send thesmae data in table form direct in the mail and not in mail attachment . cat Employee.sql SET VERIFY OFF SET PAGESIZE 200 SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON - HEAD... (0 Replies)
Discussion started by: mani_isha
0 Replies

7. Shell Programming and Scripting

Pull E-mail address from file, send e-mail

Hello, I am new to perl and need to create a script that will read a file and pull a name from the file and send e-mail. How can I use the following awk statement in a perl script? grep UNIXadmins /root/mail.conf | awk '{ print $2}' and use the output to send a e-mail. Any help would... (1 Reply)
Discussion started by: DC Heard
1 Replies

8. UNIX for Dummies Questions & Answers

how to send mail from server to client's email-id

i want to send email from server to the client's email-id. server is solaris. please help me out.i want to send mail to the email-id not to the var/spool/mail. (8 Replies)
Discussion started by: parmeet
8 Replies

9. HP-UX

Sending msg From Unix Server to an E-mail Address

Dear Brothers in Unix I would like to change some HP-UX settings in order that the system send a message to root it should be copied to my e-mail address in Microsoft Exchange Server. Please can you help me. Best Regards and thanks in advance Gege (2 Replies)
Discussion started by: cgege
2 Replies

10. UNIX for Dummies Questions & Answers

can not send mail from unix server to company/yahoo mail

hi, Gurus, I need some help with sending mail out from my UNIX server: It is running Solaris 2.6 and the sendmail version is 8.8. Output of :/usr/lib/sendmail -d0.1 -bt < /dev/null Version 8.8.8+Sun Compiled with: LOG MATCHGECOS MIME7TO8 MIME8TO7 NAMED_BIND NDBM NETINET ... (5 Replies)
Discussion started by: b5fnpct
5 Replies
Login or Register to Ask a Question