how to send an email with some body content and attachment


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to send an email with some body content and attachment
# 1  
Old 11-29-2006
PHP how to send an email with some body content and attachment

hi
plz help me in sending a mail with some data in body and an attachment as some txt file.
currently i am able to send mail with some body content, i need an example how to send the same along with attachment.
thanks in advance
-bali
# 2  
Old 11-29-2006
check the FAQ section
# 3  
Old 08-20-2008
Try this

(echo "$CONTENT \n"\
; uuencode $ATTACH_OUTPUT_FILE $ATTACH_FILE_NAME)\
| mail -s "$SUBJECT" "$MAIL_ADD"

Here CONTENT is the content of the file
CONTENT="Hi All, PFA the file"
ATTACH_OUTPUT_FILE is the file name along with path on disk
ATTACH_OUTPUT_FILE="/tmp/records.dat"
ATTACH_FILE_NAME is the file name you want to appear in the mail.
ATTACH_FILE_NAME="Employee Records.txt"
SUBJECT is subject of your mail
MAIL_ADD is the mail address.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Sending email with message body and attachment

Hello experts!! I am trying to send an email with message body and attachment.but i am getting any one like message body or attachment. I tried below command: (echo "subject:test";echo "MIME-Version: 1.0";echo "content-transfer-encoding:base 64";echo "content-type:txt;name=test.txt";cat... (2 Replies)
Discussion started by: Devipriya Ch
2 Replies

2. Shell Programming and Scripting

Body content is in random format while sending email from Linux to my outlook.

Hi I have a script running in lunix machine which emails log file content to my outlook. Here is the actual log file result: Image-1 In-Master:25028 ReplicaDn Consumer Supplier Delay dc=xxx,dc=com lmjker0110:12345 ... (4 Replies)
Discussion started by: buzzme
4 Replies

3. Shell Programming and Scripting

Send SAS Graph in Email Body from UNIX

Hi Friends, I am trying to send a graph in Body of HTML Email which is generated using a SAS Code. But, I am not able to see the picture, Instead seeing a red cross mark in Email Body. Could you please help me in fixing this problem? Also, I do not have a Shared Place (or) a web server to... (0 Replies)
Discussion started by: Samuels
0 Replies

4. UNIX for Dummies Questions & Answers

Send email with attachment and body : mailx , waiting for input , signal Control D

Hi, I am trying to send email with attacment and body using "mailx" (cat body.txt; uuencode attach.txt) | mailx -s "Attachment" abc@xyz.com When i type this command, the shell is still waiting for me to enter something in standard input and press control D before it sends a mail and... (2 Replies)
Discussion started by: aliaszero
2 Replies

5. UNIX for Dummies Questions & Answers

Sending email with attachment and body

Hi I want to able to attach a file to a email and send it with a body the body of the email is within the "body" file, and the attachment in "atch" if i send like below it will send the email correctly /usr/sbin/sendmail me@you.com< body And when i send the attachment alone... (3 Replies)
Discussion started by: sridanu
3 Replies

6. Shell Programming and Scripting

send attachment and body in one mail using mailx

Hi, Our requirement is to send an attachment and content in a single mail. I am using the below command to send attachement. --------------------- (uuencode $exp_file $exp_file) |mailx -s "$email_subject" $EmailRecipients -------------------- I m not able to send any message in the... (4 Replies)
Discussion started by: ashwin3086
4 Replies

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

8. UNIX for Dummies Questions & Answers

To send an email with the body content extracted from a file

Hi, I have been trying to shoot an email with the email body to be obtained from a file. Can someone please help me with it.. I have been trying to use the MAILX commad for the same. mailx -s "test email" -r sender@test.com < file.txt but it sends the file as an attachment,while i... (3 Replies)
Discussion started by: rohit.shetty84
3 Replies

9. AIX

Command line/Script to send E-mail with HTML body and binary attachment

I apoligize for the cross-post but I'm not getting much in the way of help in the dummies forum: I'm trying to script sending an e-mail message on an AIX 5.x server with the following requirements: 1. command line switch to specify file name containing message body in HTML format 2. command... (3 Replies)
Discussion started by: G-Man
3 Replies

10. UNIX for Dummies Questions & Answers

AIX send mail with HTML message body and a binary attachment

I'm trying to script sending an e-mail message on an AIX 5.x server with the following requirements: 1. command line switch to specify file name containing message body in HTML format 2. command line switch to specify file name of a binary attachment 3. command line or input file to specify... (4 Replies)
Discussion started by: G-Man
4 Replies
Login or Register to Ask a Question