Hello,
I am using a template for an email database. This has a MySQL database
where the end user can sign up to receive my email newsletter, They
subscribe and are entered into a MySQL database that I have set up.
Everything works fine as far as being entered into the dataase The
problem occurs when I send a test email to the database list. (I am
sending one to myself). The email never gets sent!
the code to send out the email from the MySQL database list is as follows:
\n"; //put your name and
sending address here
$reply_to = "<[EMAIL PROTECTED]>\n"; //reply-to, insert your address
here, might not be supported by your server
$return_path = "[EMAIL PROTECTED]"; // return-path, if you have
one, also might not be supported by your server
$x_sender = "<[EMAIL PROTECTED]>\n"; //your address, another setting
possibly not supported by your server
$message .= "\n\n This is a double opt-in mailing list. All recipients
have confirmed their subscription. If you no longer wish to receive
these emails, please go to http://$list_owner_domain_name \n
Get this custom mailing list system for
your site. Go to
http://www.karlcore.com for more info! \n";
// this selects the table and orders the results by the name
// it only selects the listings that have been confirmed
$query = "
SELECT
*
FROM
mailinglist
WHERE
subscribe=1
AND
confirmed=1";
$result = mysql_query($query);
while ( $row = mysql_fetch_array($result))
{
$rec_id = $row["rec_id"];
$email = $row["email"];
$recipient = $email;
$headers = "From: $sender";
$headers .= "Reply-To: $reply_to";
$headers .= "Return-Path: $return_path";
$headers .= "X-Sender: $x_sender";
$headers .= "X-Mailer: PHP4\n"; //mailer
$headers .= "X-Priority: 3\n"; //1 UrgentMessage, 3 Normal
$headers .= "Mime-Version:1.0\n Content-Type: text/plain;
charset=\"iso-8859-1\nContent-Transfer-Encoding: 8bit\n";
mail( $recipient, $subject, stripslashes($message), $headers );
sleep(1);
}
// run second query to automatically dump unsubscribed email addresses.
$query2 = "
DELETE FROM
mailinglist
WHERE
subscribe='0'
AND
confirmed='0' ";
//run the query
mysql_query($query2, $link) or die (mysql_error());
mysql_close();
header("location: mailsent.php");
exit;
?>
The form is located here:
http://www.inspired-evolution.com/sendmailform.php
let me know if I need to provide any more information.
Thanks!
Bruce Gilbert
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php