Sponsored Content
Top Forums Shell Programming and Scripting Sending a csv attachment and html text together. Post 302660151 by clx on Friday 22nd of June 2012 06:36:19 AM
Old 06-22-2012
A common format with sendmail using MIME,

Code:
sendername="some name"
senderaddress="some address"
sendto="some address"
now=$(date)
version="1.0"
boundary=$$
filenmae=

tempfile=tmp.$$


echo "From: \""$sendername"\" <"$senderaddress">" >> $tempfile
echo "To: "$sendto >> $tempfile
echo "Date: "$now >> $tempfile
echo "Mime-Version: 1.0 "$version >> $tempfile
echo "Content-Type: Multipart/Mixed; boundary=Message-Boundary-"$boundary >> $tempfile
echo "Subject: "$subject>> $tempfile

echo "--Message-Boundary-"$boundary >> $tempfile
echo "Content-type: text/html; charset=US-ASCII" >> $tempfile
echo "" >> $tempfile
echo "" >> $tempfile

cat $filename >> $tempfile

echo "" >> $tempfile

echo "--Message-Boundary-"$boundary >> $tempfile
echo "Content-type: Application/Octet-stream; name=$filename; type=Binary" >> $tempfile
echo "Content-disposition: attachment; filename=$filename" >> $tempfile
echo "Content-transfer-encoding: X-UUencode" >> $tempfile
echo "" >> $tempfile
uuencode $filename $filename >> $tempfile



/usr/lib/sendmail $sendto < $tempfile


rm $tempfile

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

sending mails with attachment and also some text in mail body

Hi, Can some one help me with the syntax of the mailx that should send an attachment and also some text in the message body together. When I am using the following syntax it is not sending the attachment but only the message body. unix2dos -ascii $REPORTFILE | uuencode $PCFILE | mailx -s... (7 Replies)
Discussion started by: guptan
7 Replies

2. Shell Programming and Scripting

Sending email with text & attachment using mailx

I spent some time working this out, with a little help from various forums, and thought the community would like to know : Here is how you can send an email from a single Unix command line : /usr/bin/echo "Email text\nNew line\nAnother new line" >x | uuencode sourcefile.txt sourcefile.txt |... (3 Replies)
Discussion started by: haryadoon
3 Replies

3. 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

4. UNIX for Dummies Questions & Answers

HTML message with attachment (text-file)

Hello: I've searched de forum but could not find an answer to send an email via sendmail in HTML with an text-file (plain-text) as attachment: My code: export FROM="Me" export MAILTO="mymail" export SUBJECT=$TITULO$bbdd export BODY=$LOG ( echo "FROM:$FROM" echo "To: $MAILTO"... (2 Replies)
Discussion started by: Felix2511
2 Replies

5. Shell Programming and Scripting

Sending HTML attachment through mail

Hi I am new to unix and scripting.I am trying to send a html file as an attachment. SUBJECT="Type of Exceptions in Application" TO=Sushovan.Samals@gmail.com SPOOLFILE=/data/reg/tlogs/Monitor.html #echo "Send the E-mail message..." uuencode $SPOOLFILE $SPOOLFILE | mailx -s "$SUBJECT" $TO... (2 Replies)
Discussion started by: sushovan
2 Replies

6. Shell Programming and Scripting

Not able to attach text in body of email while sending mail with attachment

Hi, We have been trying to send mail with attachment and it is going fine, but when we try to attach a text to the body of the email, we find that the mail is going fine with the body text but the attachment is not going through. We are using ksh. The command that is successfull without the... (6 Replies)
Discussion started by: jmathew99
6 Replies

7. Shell Programming and Scripting

Problem in sending inline html with an attachment using sendmail

MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=border --border Content-Type: text/html Content-Disposition: inline <html><body><h2>This text should be displayed with html formatting</h2></body></html> --border Content-Type: text/plain Content-Disposition: attachment This text... (2 Replies)
Discussion started by: thulasidharan2k
2 Replies

8. UNIX for Dummies Questions & Answers

Sending html email with html attachment

Hello, I have a script which is sending an html file as an attachment. #!/usr/bin/ksh export MAILTO="user@company.com" export CONTENT="/usr/tmp/file.html" export SUBJECT="EmailSubject" ( echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo "Content-Type: text/html" echo... (0 Replies)
Discussion started by: sreenathkg
0 Replies

9. Shell Programming and Scripting

Mail sending with multiple attachement(pdf and csv) with html content from Linux

Hi, We have a requirement to send multiple attachment(pdf and csv) along with html content in a single mail. For that we are using uuencode. It is working for single pdf attachment and html content. But we are unable to send both pdf and csv attachment with html content. Below is the script.... (5 Replies)
Discussion started by: dholea
5 Replies

10. Shell Programming and Scripting

Need help in sending html mail with attachment

Hi Everyone, I am facing problems in sending html mail with attachemnt. I will able to send mail with attachment (plain text ) using mailx -s and uuencode command and also html mail without attachment using sendmail option. However I am not able to send html mail along with attachment.Either... (2 Replies)
Discussion started by: karthik adiga
2 Replies
CCS_CONFIG_VALIDATE(8)					      System Manager's Manual					    CCS_CONFIG_VALIDATE(8)

NAME
ccs_config_validate DESCRIPTION
Usage: ccs_config_validate [options] OPTIONS
-h Print this help, then exit -V Print program version information, then exit -v Produce verbose output Validating XML configuraton files: -f configfile Validate an alternate config file without preloading it with default values. -l configfile Validate an alternate config file with preloading of default values (recommended option). Advanced options: -r Force validation of runtime config -C config_loader Override config plugin loader -t tempfile Force temporay file to tempfile -n Do not remove temporary file -o Overwrite temporary file (dangerous) DEFAULT
Default operation for ccs_config_validate is to load the currently configured environment and verify the outcoming configuration. Example 1: current environment uses a configuration file (/etc/cluster/cluster.conf). The user modifies cluser.conf and executes ccs_config_validate without options. The tool will validate the modified cluster.conf after including default values. Example 2: current environment is set to load the configuration from LDAP. Users modifies LDAP databse and before pushing the change to the nodes, she/he can issue ccs_config_validate to verify the contents o the LDAP database automatically (as long as the correct LDAP environment is set in the cman/cluster sysconfig/defaults files). September 2009 CCS_CONFIG_VALIDATE(8)
All times are GMT -4. The time now is 05:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy