开发者

send simple email using unix shell command

I am new to unix environment. Well, I just want to send an email 开发者_StackOverflow社区using unix shell script. I do not know whether I have rights to do in my user role or not. This is script I tried to run it.

#!/bin/bash
# script to send simple email
# email subject
SUBJECT="SET-EMAIL-SUBJECT"
# Email To ?
EMAIL="test@mail.com"
# Email text/message
EMAILMESSAGE="mail.txt"
echo "This is an email message test"> $EMAILMESSAGE
echo "This is email text" >>$EMAILMESSAGE
# send an email using /bin/mail
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE

This script resulted in 0403-006 Execute permission denied

Can anyone help me to send a simple email using some shell script...

Thanks for you time...


Make sure that the script has its execute permission bits set and that the interpreter in the shebang exists, or that you're invoking it via the interpreter.


The error code 0403-006 Execute permission denied means (as it says) you don't have permission.

This could be because of one of two reasons

  1. The most likley on is that the script doesn't have execute permissions. Try running:

    chmod +x /bin/mail
    

    This should allow you to execute the file.

  2. Other wise you don't have read permissions but because you created the file i doubt that.


Remove the double quotes around $EMAIL and $SUBJECT and try again.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜