okay, first I put the text block from a database into a text file (requests.txt) and replace the html break tags with '\n'
cat $HOME/housekeeping/requests.txt | sed -e 's/<br>/\\n/g' -e s/\'
+\;/\'/g > $HOME/housekeeping/requests2.txt
this gives me a text file containing for example:
Date : 2001-09-26 10:47:00
Request No. 107
Request Title: CHILDREN
Request : 1. 13 year old twin boys\n2. A boy aged 13 years old standing
facing the camera\n3. A girl aged 13 years old standing facing the camera\n4.
A girl & a boy aged approx 13 years old standing in front of the Eiffel Tower,
Paris\n5. A girl aged approx 11 years old on a beach in Greece(or could be anot
her location as long as it is not too exotic)
Format :
Deadline : 2001-9-27
Budget : £85 per pic used
Name : Louise Edgeworth
Company : Pearson Education
Country : United Kingdom
Telephone : 01279 793472
Fax : 01279 793472
Email : edgeworthl@aol.com
Then I run the perl script and use this code to format the email:
open(REQUESTS,"/home/picturesea/housekeeping/requests3.txt") || di
+e "requests3 file not found";
# Open The Mail Program
open(MAIL,"|$mailprog -t");
print MAIL "Bcc: $emails\n";
print MAIL "From: chrisbarton\@postmaster.co.uk (PICTURE SEARCH)\n
+";
print MAIL "Subject: PICTURE SEARCH REQUESTS $date\n\n";
print MAIL "If you think you have suitable images, please CONTACT
+THE RESEARCHER DIRECT.\n YOU DO NOT NEED TO REPLY TO THIS EMAIL.\n";
print MAIL "$date\n";
print MAIL "-" x 75 . "\n";
while ($requests = <REQUESTS>) {
print MAIL "$requests";
}
close(REQUESTS);
this all works fine and the email is formatted fine, except the request text comes out:
Request : 1. 13 year old twin boys\n2. A boy aged 13 years old standing
facing the camera\n3. A girl aged 13 years old standing facing the camera\n4.
A girl & a boy aged approx 13 years old standing in front of the Eiffel Tower,
Paris\n5. A girl aged approx 11 years old on a beach in Greece(or could be anot
her location as long as it is not too exotic)
when what I want is:
Request : 1. 13 year old twin boys
2. A boy aged 13 years old standing facing the camera
3. A girl aged 13 years old standing facing the camera
4. A girl & a boy aged approx 13 years old standing in front of the Eiffel Tower, Paris
5. A girl aged approx 11 years old on a beach in Greece(or could be another location as long as it is not too exotic
ie the '\n's don't get translated as line breaks - any idea why this is? | [reply] [Watch: Dir/Any] [d/l] [select] |
perl -pe "s/<br>/\n/g; s/\'/'/g;"
alex pleiner <alex@zeitform.de>
zeitform Internet Dienste | [reply] [Watch: Dir/Any] [d/l] [select] |
Guys, It was very difficult to figure how we can break the line text email.
I have found a very simple solution just "break the line in your code" and it will do the same in the email as well.
eg: I have done this in PHP
------------------------
message ="Hello World
Now this is my next line message";
Message .= "Dear".$var.",
again this next lien message"
---------------------------
Thats it and it works fine with me..
Cheers,
Azim
| [reply] [Watch: Dir/Any] |