PDA

View Full Version : eMail



jameson
07-29-2009, 04:03 PM
Hi,

I have an app built in html to email some data to a recipient. My problem is that it keeps asking for email client information. I need the app to run on the server, not to look at the users machine for email info. So the user would press the button and the email is sent from the server from a specified email address. Any help would be greatly appreciated.

Thanks

Jameson

djmatt
07-29-2009, 06:43 PM
You can use PHP to send email based on data submitted in a form. It sends email from your server, so you will be subject the email limitations that Bluehost has - 50 to 500 emails an hour.

<?php
$mymessage = $_POST['mymessage'];
$youremail = $_POST['youremail'];
$yourname = $_POST['yourname'];
$theiremail = $_POST['theiremail'];
$theirname = $_POST['theirname'];
$office = $_POST['office'];
$candidate = $_POST['candidate'];


$to = $theiremail;
$subject = $myname . " Is Running For " . $office ;
$msg = "Hi " . $theirname . ",\n" . $mymessage ;
$msg = $msg . "\n\nRead More:\nhttp://www.???.org/" . $candidate ;
$msg = $msg . "\n\n". $yourname . "\n\n------------------------------------------\nPlease note, this email was generated on our web site by a visitor, not anyone acting on behalf of ??? or ". $myname . ". We did not store your email and you will not get any more emails from us because of this email.\nhttp://www.???.org" ;
$headers = "From: " . $youremail . "\r\n" . "Reply-To: " . $youremail . "\r\n";
mail($to, $subject, $msg, $headers);
?>

jameson
07-30-2009, 08:15 AM
Thanks Matt, I'll give it a try