Jump to content

email question


aslanandbeez

Recommended Posts

Hey, I have cobbled together some code to store peoples detailsd and send me an email with said deteils, but I'm not getting the email so here's the code, what am I doing wrong? (I've left our the password for obvious reasons

 

<?php

 

$firstName = strip_tags(trim($_POST['first_name']));

$lastName = strip_tags(trim($_POST['last_name']));

$email = strip_tags(trim($_POST['Email']));

$message = strip_tags(trim($_POST['Message']));

 

$db_name="jonbak0_db";

$db_username="jonbak0_db";

$db_server="mysql4.freehostia.com";

$db_password="";

 

$sql = "INSERT INTO emailSignup (firstName,lastName,email,message) VALUES

('$firstName','$lastName','$email','$message')";

mysql_query($sql);

 

$to = "[email protected]";

$message = $_POST["Message"];

$messagesent = "From: $email Message: $message";

$from = $_POST["Email"];

$headers = "e-mail sign up from: $from";

mail($to,$messagesent,$headers);

echo "Your details have been sent, thank you.";

?>

Link to comment
https://forums.phpfreaks.com/topic/106976-email-question/
Share on other sites

Have you tried

 

<?php

mail('[email protected]', 'test', 'test');

?>

 

If it doesn't work it's a problem with mail, not your script

 

Edit: Also, you don't actually connect to the database.

 

<?php

$con = mysql_connect($db_server, $db_username, $db_password);
mysql_select_db($db_name, $con);

?>

Link to comment
https://forums.phpfreaks.com/topic/106976-email-question/#findComment-548336
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.