Proper syntax for mail() function 5th parameter

Hi everyone!

Sorry for the noob question, but I’m a complete php noob and I cannot find the answer anywhere.

My question is simply what is the proper syntax to use for passing a variable through the 5th parameter of the mail() function.

This is what I have:
[php]if(mail($cellemail, $subject, $message, $from, "[email protected]"))[/php]

I want to use a variable for the 5th parameter like this:
[php]if(mail($cellemail, $subject, $message, $from, “-f$from”))[/php]

I know it’s not correct but I’m not sure what the proper syntax is to use the -f flag with the $from variable.

Any help is greatly appreciated! thx :slight_smile:

I did find a solution, by declaring the value in a string above the if statement, but I’d still like to know what the syntax would be to use the variable and the -f flag from within the mail() function. Is it possible? Which method is better?

This is what I did:
[php]$return = “-f”.get_option(‘sms_from_email’)." ";
if(mail($cellemail, $subject, $message, $from, $return)) [/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service