I want to send a mail through shell script,If it is possible Please give me a code.
mail id : upload.xxx@example.com
I want to send a mail through shell script,If it is possible Please give me a code.
mail id : upload.xxx@example.com
Hello kannansoft1985,
Here is an example for same.
MAILFROM=Singhisking@test.com
MAILTO=Singhdaddy@test.com
FILE=/singh/test/results_test.txt
cat - ${FILE} <<EOF | /usr/sbin/sendmail -oi -t
From: ${MAILFROM}
To: ${MAILTO}
Subject: $SUBJECT
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
EOF
Thanks,
R. Singh
I tested to execute the below mail But the mail not sent , please check it
#!/bin/bash
MAILFROM=upload.xxx@example.com
MAILTO=upload.xxx@example.com
FILE=/root/msg.txt
cat - ${FILE} <<EOF | /usr/sbin/sendmail -oi -t
From: ${MAILFROM}
To: ${MAILTO}
Subject: $SUBJECT
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
EOF
[SIZE=3][FONT=Calibri]
try
echo "Mail Body" | mailx -s "Hello Friends" upload.xxx@example.com
Or if you want to send file contents as mail body
mailx -s "Hello Friends" upload.xxx@example.com < file.log
I try this both , But it's also not sent the mail to upload.xxx@example.com
echo "Mail Body" | mailx -s "Hello Friends" upload.xxx@example.com
Or if you want to send file contents as mail body
Code:
mailx -s "Hello Friends" upload.xxx@example.com < file.log
1) is upload.xxx@example.com
exists?
2) is mail installed on your linux/unix box?
what is output of below command which mail
I am using Rehat version 4.4 operating system.
I am assigning mail name is another which is exist.
Pre-installed
output of which mail is /bin/mail
---------- Post updated at 04:10 PM ---------- Previous update was at 03:18 PM ----------
Is anyone know about troubleshooting the mail problem.Please help me to resolve this problem.
---------- Post updated at 04:32 PM ---------- Previous update was at 04:10 PM ----------
What are all the steps to be taken for troubleshooting the mail problem.
Hello kannansoft1985,
I just now checked that you have asked almost same question in following post yesterday Mail not sent through terminal and we have tried to help/solve/guide you on same. I can see you have updated 3 times your today's post and asked almost same kind of question which should be considerd bumping up the posts. If you need help/guidance from us kindly let us know in previous post(As that post is still open status) itself with details what you have tried to find out from your side. As I can see we have tried from our side to give you answers. But this forum is not only for helping people but also help them in learning things too, hope you will take me in positive manner please as I am also a learner and learning never ends whole life.
Thanks,
R. Singh
thread closed - please continue here: