CMR
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Downloads
Gallery
Store
Posts posted by CMR
-
-
Hi,
If you want to add in a From: header, you can do this:
/* Prepare autoresponder subject */ $respond_subject = "Thank you for contacting us!"; /* Prepare autoresponder message */ $respond_message = "Hello! Thank you for contacting us! We will get back to you as soon as possible! Yours sincerely, Your name www.yourwebsite.com "; /* Headers */ $headers = "From: MyName <myAccount@myDomain.com>\r\n"; $headers .= "Reply-To: anotherAccount@myDomain.com\r\n"; // Etc... /* Send the message using mail() function */ mail($email, $respond_subject, $respond_message, $headers);
Looking at this line in your code:
mail($myemail, $subject, $fname, $lname, $email, $login);
I can't imagine that works does it?
You seem to be passing the variables gained from your html form in the mail() function, when what you should be passing is: mail(to, subject, message, headers, extraparameters)
What you'll want to do if you're trying to send an email with those variables displayed in it, is just put them in the message body somewhere, eg:
/* Example Since I DOn't Know What You're Setting The Variables To */ $myEmail = $_POST['email']; $subject = 'My Subject'; $message = "Hello, Here are the details you entered: First Name: {$fname} Last Name: {$lname} Email: {$email} Login: {$login}"; $headers = "From: MyName <myAccount@myDomain.com>\r\n"; $headers .= "Reply-To: anotherAccount@myDomain.com\r\n" if($result) { mail($myemail, $subject, $message, $headers); header("location: register-success.php"); exit(); }else { die("Query failed"); }
Regarding this bit:
$message="$name just filled in your comments form.\n\nTheir phone number is:\n$phone\n\nThey live in:\n$city\n\nThey said:\n$comments\n\nTheir e-mail address is: $email"; if(mail($to,"Message From MC-HRSolutions.com",$message,"From: $email\n")) { echo "Thank you for your enquiry."; } else { echo "There was a problem sending the mail. Please check that you filled in the form correctly.";
I tried it on my server and I didn't get any errors, so the error must be in a different section of the code. If you post the whole page of code, I'll see if I can see it.
Also, you'll probably want to use the $headers as I outlined above for that section of code.
A birthday Alert App
in PHP
Posted
What you could do is something along the lines of this:
Table Structure:
userid - int (10) auto_increment primary key,
username - varchar (50),
userdob - varchar (25),
// Any Other Fields...
Store the userbirthday in this format:
dd month YYYY (Eg: 10 April 1970, 03 December 1986, etc...)
Now, using php you could take that string and turn it into timestamp using strtotime(), eg: