I have created a basic form whose database functionality works fine (upon submitting the form, the data is sent to the database). I am trying to ALSO send an email to myself saying that the information was submitted. I tried including onsubmit="mailto:email@mydomain.com" in the FORM tags, but nothing seems to be happening. I am running a Plesk 8.4 VDS with red hat 7 purchased through GoDaddy - do I need to setup backend pages within the server for php mail functions? someone PLEASE help, thanks!
Short answer. Yes, you do. What you've included will do nothing (except maybe open the client's default email application.) http://php.net/mail
hmm, you need to look at php's default mail function just like what the poster above says ex: mail('recipient@mail.com','subject','body');
if you have login through mail id then $to =$_COOKIE['mail']; // static mail id here seperated comma if youo want to insert more email $subject = "Subject Name"; $headers = "MIME-Version: 1.0\r\n"; $headers = "From: Portal name <from address here>\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $body ="<p>Hello ".$names."</p><p>Your data for portal is: ".$newdata." </p><p><p>Thank You</p> <p>This is Auto generated mail from <domain name></p>"; mail($to,$subject,$body,$headers); setcookie("top", "Thanks For Submitting data", time()+3600); header("Location: http://url address");
If he is sending the mail to himself, as per OP then you don't need to retrieve the email address from a cookie, rather hard coding it into the application.
$message='User: '.$username."\n\n"; $message.='They just submitted the form to the database'; $headers='From: My Site <me@mysite.com>'."\r\n"; $headers.='Reply-To: My Site <me@mysite.com>'."\r\n"; mail("me@mysite.com","Data Submitted",$message,$headers); Code (markup):