send text mail to windows


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting send text mail to windows
# 1  
Old 01-13-2012
send text mail to windows

Hi I have the following 'atd' batch script to send mail to a windows (outlook) system:

....
....
LESSOPEN=\|/usr/bin/lesspipe.sh\ %s; export LESSOPEN
G_BROKEN_FILENAMES=1; export G_BROKEN_FILENAMES
cd /root/bin || {
echo 'Execution directory inaccessible' >&2
exit 1
}
${SHELL:-/bin/sh} << 'marcinDELIMITER152378e7'
echo -en "

My text justified
other txt justied

" | /usr/bin/env smtp=192.168.11.11 MAILRC=/dev/null nail -r myuser1@mydom -s "my subject" myuser2@mydom

...
..


The mail was sent successfully but windows see the text without the CR character.. so there is not any justification..
I tryed to add "\r\n" or "\\\r\\\n" to the end of each line.. without any changes.
Under linux I have not any problem: I see the justified text as I want... but not under windows..

I also tryed to send an html+css ("align-text: justify") mail but the command nail (mailx) doesnt support the html format.. that mean I cant add any "content-type: html/text" header to the mail..

Any idea ??
thanks
luigi
# 2  
Old 01-13-2012
hi,

think about saving the body of the message in a file, converting that file with unix2dos, and finally using the content of the file as input for mail.

see ya
fra
# 3  
Old 01-13-2012
maybe I cant send mail with "\r\n" end line.. infact I read on the man:

Mailx expects input text to be in Unix format, with lines separated by newline (^J, \n) characters only. Non-Unix text files that use carriage return (^M, \r) characters in addition will be treated as binary
data; to send such files as text, strip these characters e. g. by

tr -d '\015' <input | mailx . . .

or fix the tools that generate them.


:-(
# 4  
Old 01-13-2012
After reading frappa's post and ensuring that the mail body starts out in unix text format, I'd expect the pipeline to be in the order "ux2dos"-"uuencode"-"mail program". Too difficult to follow your script.

There is a basic problem with Microsoft Outlook. The default changed (in 2003 I think) such that this box is checked in error:
Tools/Options/Preferences/E-mail options/"Remove extra line breaks in plain text messages"
Uncheck the box.


Btw. I don't understand your script fragments at all (much too obfuscated). Only going by the symptoms.

Last edited by methyl; 01-13-2012 at 10:49 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bold text in Bash and send mail

I have a sample script here I want to bold the word BOLD in the text and send through email. Tried several ways but not seems to working. BODY="Hello. I want to BOLD this" { echo "From: from@gmail.com" echo "To: to@gmail.com" echo "Subject: Texting" ... (1 Reply)
Discussion started by: lpoolfc
1 Replies

2. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies

3. UNIX for Beginners Questions & Answers

Manipulate condition to send mail based on output text in file

Hi All, I have a working script as below. echo "Files loaded with $(cat /var/tmp/script.X1.out)" | mail -s "Files loaded with return code" mailid This script takes the output from script.X1.out file and appends the text "Files loaded with return code" and sends the email. Now what I want... (5 Replies)
Discussion started by: midhun3108
5 Replies

4. UNIX for Beginners Questions & Answers

Shell script to compare text and send a mail

Hello, Somebody can help me to develop a script for the below requirement I have a 3 files in a directory which was dynamically changed everyday basis. I need a script to fetch the 1pattern of strings in each file. if the three matching pattern is same send a mail with subject as success else... (1 Reply)
Discussion started by: MATHANKUMAR
1 Replies

5. Shell Programming and Scripting

How to send colorful text and attachment to mail

Hi, I want to send color text as body of mail with multiple attachments.How to do this?I used sendmailcommand but this command fails for multiple attachments.Give me some solution on this. :wall: (0 Replies)
Discussion started by: AhmedLakadkutta
0 Replies

6. Shell Programming and Scripting

Send a mail to IDs listed in a text file

I have a list of mail ids in text file and want a ksh script that reads this text file and sends a mail to all mail ids with same subject line and content. I am using UX-HP machine and KSH. Thanks for help in advance! (5 Replies)
Discussion started by: Sriranga
5 Replies

7. Shell Programming and Scripting

Send mail with rich text / HTML with image

Hi, Is it possible to send mail from my HP-Ux system with images, rich text? I would like to program in such a way that I have my company's logo(.jpg) image attached in the mail geeting triggered. I would like to send a rich text/HTML email instead of plain text mail to the recipients. Is it... (2 Replies)
Discussion started by: rythym05
2 Replies

8. UNIX for Dummies Questions & Answers

Send Text message from unix to windows

Hi Buddies, I have a unix client and want to send a message (containg some data) to a windows Database server to query from it and return the result. I shall be so thankfull if you help me out.:b::) Warm Regards, Jessi (1 Reply)
Discussion started by: jessica-adams
1 Replies

9. Shell Programming and Scripting

Send an attachment and html text both in the same mail

Hi all, I am working on UNIX (Solaris28). I would like to send an email in which the body will be in html format and, in the same mail, a xls file has to be attached. I have tried this: the file is correctly attached but the body comes as html source and not formatted. If I do not attach the... (4 Replies)
Discussion started by: stefan.yu
4 Replies

10. UNIX for Dummies Questions & Answers

Send text file to mail

I have a utility that opens a telnet session and allows me to execute commands through a script. The utility allows me to output to a text file whatever is outputted to screen. This utility runs from a DOS prompt in Windows 95/98, NT or 2000. How can I mail text file this to a certain user. I... (2 Replies)
Discussion started by: petrosi
2 Replies
Login or Register to Ask a Question