Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

PHP noob cannot get mail function to send?

the mail() function

Moderators: macek, egami, gesf

PHP noob cannot get mail function to send?

Postby Satchelmouth » Sun Jun 19, 2011 1:15 pm

Hi all,
I'm a total noob with PHP (i'm usually a javascript and html coder) and i am having some trouble with this block of code:

$fname =$_POST["firstname"];
$sname =$_POST["lastname"];
$comp =$_POST["company"];
$subject="{$fname} {$sname} has requested that you send them a CV.";
$message="{$fname} {$sname} of {$comp} has requested that you send a copy of your CV to {$email}.";
$headers = 'From:' . "\n" .
print "{$message}";
print "{$subject}";
print "{$to}";

This is not sending an email no matter what I try. is there a problem with the code or is it a problem with my apache server? P.S. i have verified that all information is being carried from forms using POST, with the print functions. I am not getting any errors (such as internal server errors with this code).

Any help with this would be much appreciated.
New php-forum User
New php-forum User
Posts: 1
Joined: Sun Jun 19, 2011 1:09 pm

Re: PHP noob cannot get mail function to send?

Postby Nullsig » Mon Jun 20, 2011 1:14 pm

on your headers line:
Code: Select all
$headers = 'From:' . "\n" .

you need to replace the second "." with a ";"
Code: Select all
$headers = 'From:' . "\n";
User avatar
php-forum Fan User
php-forum Fan User
Posts: 981
Joined: Thu Feb 17, 2011 6:52 am
Location: Racine, WI

Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.