| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

11-18-02, 13:44
|
|
Registered User
|
|
Join Date: Nov 2002
Posts: 4
|
|
SendMail embedding linefeeds in the message body
|
|
OK, first, I haven't even begun unix 101 or shell scripts so go easy with me. This is what we're using and it works, I'd just like to dress up the body by inserting newline/return/LFCR, tabs, etc .... Is it possible?
java SendMail -g est04grp -f pcunix -s "EST04 Notification" -m "Attached please find two reports: est04.fc.new which contains a list of original Final Certificates printed and est04.fc.rep which contains a list of reprinted Final Certificates. Please contact Jeff Miller, if there are any questions or concerns. Thank you." -a "$NEW_FC_REPORT" -a "$REPRINTED_FC_REPORT"
|
|

11-19-02, 04:46
|
|
Padawan
|
|
Join Date: Jun 2002
Location: UK
Posts: 525
|
|
You should be able to use escape sequences with the backslash character...
The example below is all on one line.
echo "Here is a newline...\n\t...and this line begins with a tab\nand here is \"some text\" in enclosed quotes."
Here is a newline...
...and this line begins with a tab
and here is "some text" in enclosed quotes.
|
|

11-19-02, 12:30
|
|
Registered User
|
|
Join Date: Aug 2002
Location: UK
Posts: 87
|
|
|
|
go Damian 
|
|

11-19-02, 12:37
|
|
Registered User
|
|
Join Date: Nov 2002
Posts: 4
|
|
flournoy
It didn't work, the email is recieved with the slashes and characters printed with the text. I've tried separating the message with quotes and putting the control characters between the lines and it still prints the control characters within the body. HELP !
|
|

11-26-02, 11:02
|
|
Registered User
|
|
Join Date: Aug 2002
Location: UK
Posts: 87
|
|
Humm .... Have you tried putting the text into a script variable, and then using the script variable in the mail statement ??
|
|

11-26-02, 12:14
|
|
Registered User
|
|
Join Date: Nov 2002
Posts: 4
|
|
Yes, I have, it printed the control characters in the body.
MY_MESSAGE="HELLO....\n\t...did it work"
java SendMail -g est04grp -f pcunix -s "My Test" -m $MY_MESSAGE
And it printed in the body of the e-mail:
HELLO....\n\t...did it work
I don't know what the problem is .....
|
|

11-27-02, 12:14
|
|
Padawan
|
|
Join Date: Jun 2002
Location: UK
Posts: 525
|
|
|
|

11-27-02, 15:11
|
|
Registered User
|
|
Join Date: Nov 2002
Posts: 7
|
|
Quote:
Originally posted by Flournoy
Yes, I have, it printed the control characters in the body.
MY_MESSAGE="HELLO....\n\t...did it work"
java SendMail -g est04grp -f pcunix -s "My Test" -m $MY_MESSAGE
And it printed in the body of the e-mail:
HELLO....\n\t...did it work
I don't know what the problem is .....
|
How about not putting your \'s in quotes... end quotes before the slash?
|
|

11-27-02, 15:13
|
|
Registered User
|
|
Join Date: Nov 2002
Posts: 7
|
|
Quote:
Originally posted by backer
How about not putting your \'s in quotes... end quotes before the slash?
|
That almost appeared how I wanted it ..
I was trying to say, \\'s maybe?
|
|

11-27-02, 15:47
|
|
Registered User
|
|
Join Date: Nov 2002
Posts: 4
|
|
I've tried that,
MY_MESSAGE="HELLO...."\n\t"...did it work"
prints
HELLO....\n\t...did it work
go figure ....
With spaces
MY_MESSAGE="HELLO...." \n\t "...did it work"
prints
HELLO....
This looks way to easy to be so hard ......
|
|

11-28-02, 10:30
|
|
Padawan
|
|
Join Date: Jun 2002
Location: UK
Posts: 525
|
|
I've tried this and it seems to work okay...
public class JavaTest {
public static void main (String[] args) {
System.out.println(args[0]);
}
}
java JavaTest "Text
on
many
lines."
The output looks like this:
Text
on
many
lines.
If passing in your message body parameter over multiple lines doesn't work, I would suggest that the SendMail application is stripping out the newlines.
|
|

12-15-02, 16:56
|
|
Registered User
|
|
Join Date: Dec 2002
Posts: 4
|
|
good old meta characters. instead of double quotes " use single quotes '
if that doesn't work you may need to escape your backslashes \ with a backslash \ themselves.
Check this. To ftp into an NT ftp server from a unix one, I had to do the following:
user domain\\\\name password
a the 4 backslashes send 2 backslashes to the script, which sends 1 backslash to the ftp program. I think you're running into the same thing. Your stuffs is being interpretted in the double quotes. single quotes will kill the issue if you're using a unix shell. escaping the backslash \ escape character with an escape character, namely a backslash, will send a literal backslash through. Of course, you may have to do what I did and escape the escape of the escape. Hehehe. any wonder why regular expressions look so funny?
|
|

12-15-02, 17:10
|
|
Registered User
|
|
Join Date: Dec 2002
Posts: 4
|
|
oops. I misread the thread. Please ignore my above lame comments. In atonement, I offer the following
$ var="foo\nbar"; export var
$ echo $var
foo
bar
$ var2=`echo $var`; export var2
$ echo $var2
foo bar
$ cat << !!
> $var2
> !!
foo
bar
Go figure, huh? Cat isn't interpretting the newlines into their ascii equivalents, but if you feed the already interpretted newlines into it, it works, but breaks the original. I'll leave it up to ya'll.
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|