How to support PHP variables with exec command?
<p>Hello I am sending mail from php. I am fetching to address and cc address from database and storing them in one one variable.
$to,$cc i need to use this in mailx command.
Following query is hardcoded and its working.</p>

<pre><code> exec('echo "hey i am there" | mailx -S smtp=10.0.8.8:25 -r support@gmail.com -s "Alert" pratik@gmail.com');
</code></pre>

<p>Need to replace </p>

<pre><code> $message = hey i am there
 $to=pratik@gmail.com
 $from =support@gmail.com 
 $subject = Alert

exec('echo $message | mailx -S smtp=10.0.8.8:25 -r $from  -s $subject $to');
</code></pre>

<p>But the above thing is not working </p>