FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Need PHP mail() help





bladesage
Okay, I've been searching for this for 20 minutes now, but can't find what I need.

The mail() function in itself isn't giving me a problem at all. It's when I try to send HTML mail that I get a problem Confused.

Here's the mailing part of my code:
Code:
$to = "someone@myplace.net";
$subject = "Your weekly DDS newsletter";
$msg = $_POST['message'];
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

mail($to, $subject, $msg, $headers);


This is driving me nuts! Can someone tell me what's wrong?
Possum
Hi

IM sorry IM new to php and cant help you with your question . But I am still curious about your code. If you were to get the info for these strings (see Below) from Mysql. Does that mean you could create a mass mailer application (not for spam)

$to = "someone@myplace.net";
$subject = "Your weekly DDS newsletter";
$msg = $_POST['message'];
......
DanielXP
Code:
$to = "YOUR-EMAIL-HERE";
$subject = $_POST['subject'];
$message = $_POST['message'];
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
      if(mail($to, $subject_field, $body, "From: $email_field\r\nReply-to: $email_field\r\n")) {
         echo "Message Sent.";
      } else {
         echo "Message Not Sent!";
      }


This is taken from my script called pluscontact 1.4

you will need to change the

* YOUR-EMAIL-HERE
* $subject
* $message

Don't understand what Possum is going on about Mysql
Possum
Sorry .. I was a little off topic.
bladesage
Possum wrote:
Hi

IM sorry IM new to php and cant help you with your question . But I am still curious about your code. If you were to get the info for these strings (see Below) from Mysql. Does that mean you could create a mass mailer application (not for spam)

$to = "someone@myplace.net";
$subject = "Your weekly DDS newsletter";
$msg = $_POST['message'];
......


Yes, that's exactly my intent. This is for a newsletter for my company. People sign up for the weekly newsletter, and it stores their first name, email address, and username in a database. The mailer script later takes each row one-by-one, and creates an email containing a greeting by name, and a message sent to it via a form I made, and sends it in HTML format.

Fortunately, I actually managed to get it all working perfectly around midnight last night (GMT-5). So now I just need to get DeFwh to make a special graphic for the mail header.

And if anyone is interested in joining the newsletter, check out the bottom of my sig. If anyone wants to learn how to send mass mail, check out a topic in the tutorials forum I'm about to make.
openaasman
that code will let you help to find out whether your mail is beign send or not. i have till you read this message you may have cought the problem.

thanking you
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.