0

I am using following code for send mail but it through msg "Null message body; hope that's ok " and mail is not send

$body='sdfsdf';
$subject='sdfsdf';
$to='[email protected]';

echo $output = shell_exec("echo $body && mail -s \"$subject\" $to");
print_r ("$output"); 
die;
6
  • 1
    Why not just use the built-in php mail function? Commented Jan 11, 2016 at 18:29
  • i have to use it by shell_exec Commented Jan 11, 2016 at 18:32
  • Is there a specific reason why you are using &&? I think it should be shell_exec("echo \"$body\" | mail -s \"$subject\" $to"); Commented Jan 11, 2016 at 18:34
  • Possible duplicate of use exec(); in a php script to send email from shell Commented Jan 11, 2016 at 18:38
  • both case it doesn't work :( Commented Jan 11, 2016 at 18:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.