Reputation: 714
I am trying to execute the following perl script.
##some code
$command = "nail -s this is a test $email";
system($command);
##some code
when I run this script, it hangs until I press CtrlD. after pressing CtrlD I get the desired result. My question is how can I hardcode CtrlD in my script?
Upvotes: 3
Views: 690
Reputation: 1
Try to use this :
mail -s "Hello Test" -a Attachment email-address </dev/null
or, if you have any email body
mail -s "Hello Test" -a Attachment email-address <emailbodyfile.txt
Upvotes: 0
Reputation: 1256
I suppose you call mailx
. nail
ist most likely an alias. It expects input from STDIN, which is ended with CtrlD. You could workaround like this to send an empty mail:
$command = 'echo "" | nail -s SUBJECT ' . $email;
Upvotes: 1
Reputation: 3189
The mail program expects an .
on a line alone to show it is the end of the message
Just make sure your $email contains a \n.
and it should no longer hang.
Upvotes: 0