Nov 19, 2010 #1 bazil2 Technical User Joined Feb 15, 2010 Messages 148 Location DE (Elementary user) Under Linux I am able to send an email from the command line and I am prompted like this: # mail some_user@some_domain.com # Subject: Test # Body: Test text Is it possible to attach a file as well? Best regards
(Elementary user) Under Linux I am able to send an email from the command line and I am prompted like this: # mail some_user@some_domain.com # Subject: Test # Body: Test text Is it possible to attach a file as well? Best regards
Nov 19, 2010 1 #2 feherke Programmer Joined Aug 5, 2002 Messages 9,541 Location RO Hi Yes, is possible. But is quite much work. Better use [tt]mutt[/tt] instead : Code: mutt -s [green][i]'Test'[/i][/green] -a [green][i]'attach.me'[/i][/green] [green][i]'some_user@some_domain.com'[/i][/green] [teal]<<<[/teal] [green][i]'Test text'[/i][/green] Feherke. http://free.rootshell.be/~feherke/ Upvote 0 Downvote
Hi Yes, is possible. But is quite much work. Better use [tt]mutt[/tt] instead : Code: mutt -s [green][i]'Test'[/i][/green] -a [green][i]'attach.me'[/i][/green] [green][i]'some_user@some_domain.com'[/i][/green] [teal]<<<[/teal] [green][i]'Test text'[/i][/green] Feherke. http://free.rootshell.be/~feherke/
Nov 19, 2010 Thread starter #3 bazil2 Technical User Joined Feb 15, 2010 Messages 148 Location DE Thank you, this worked beautifully! To elaborate on this, I have a small web programme that allows me to choose a script and input up to 4 arguments. I've made the following script changing the single quotes to double quotes. Does this approach look correct; I'm very much a beginner at scripting? #!/bin/sh # # Set the argument variables Recipient=$1 Subject$2 PathToFile=$3 BodyText=$4 # mutt -s "$2" -a "$3" "$1" <<< "$4" Upvote 0 Downvote
Thank you, this worked beautifully! To elaborate on this, I have a small web programme that allows me to choose a script and input up to 4 arguments. I've made the following script changing the single quotes to double quotes. Does this approach look correct; I'm very much a beginner at scripting? #!/bin/sh # # Set the argument variables Recipient=$1 Subject$2 PathToFile=$3 BodyText=$4 # mutt -s "$2" -a "$3" "$1" <<< "$4"
Nov 19, 2010 #4 feherke Programmer Joined Aug 5, 2002 Messages 9,541 Location RO Hi It is correct, if we ignore the missing equal sign ( = ) at the second assignment. But the assignments are pointless, as later you keep using the parameters, not the variables. But probably your intention was something like this : Code: mutt -s [green][i]"$Subject"[/i][/green] -a [green][i]"$PathToFile"[/i][/green] [green][i]"$Recipient"[/i][/green] [teal]<<<[/teal] [green][i]"$BodyText"[/i][/green] As a note, I generally do not recommend to beginners to use Bash scripts for CGI or from SSI. There are quite many points to compromise the security. Feherke. http://free.rootshell.be/~feherke/ Upvote 0 Downvote
Hi It is correct, if we ignore the missing equal sign ( = ) at the second assignment. But the assignments are pointless, as later you keep using the parameters, not the variables. But probably your intention was something like this : Code: mutt -s [green][i]"$Subject"[/i][/green] -a [green][i]"$PathToFile"[/i][/green] [green][i]"$Recipient"[/i][/green] [teal]<<<[/teal] [green][i]"$BodyText"[/i][/green] As a note, I generally do not recommend to beginners to use Bash scripts for CGI or from SSI. There are quite many points to compromise the security. Feherke. http://free.rootshell.be/~feherke/
Nov 19, 2010 Thread starter #5 bazil2 Technical User Joined Feb 15, 2010 Messages 148 Location DE Many thanks; you suggestions helped immensley. Best regards Upvote 0 Downvote