Search the Community
Showing results for tags 'mailer'.
-
I believe the solution the my problem should be simple I feel that it's staring me right in the face. I have a Cron Job that sends an email message to users who's bill "due date" falls on the current date. I want to make the email more personalized and say: Dear John Doe: You have the following bills due today: Rent Cable Internet Please login to pay your bills Thanks,. Here's my following PHP code <?php header("Content-type: text/plain"); // OPEN DATA BASE define("HOSTNAME","localhost"); define("USERNAME",""); define("PASSWORD",""); define("DATABASE",""); mysql_connect(HOSTNAME, USERNAME, PASSWORD) or die("Connetion to database failed!"); mysql_select_db(DATABASE); joinDateFilter(); // BILL QUERY function joinDateFilter(){ $query = mysql_query("SELECT bills.billname, bills.duedate, bills.firstname, bills.email, bills.paid FROM bills JOIN users ON bills.userid=users.userid WHERE DATE(bills.duedate) = CURDATE() AND bills.PAID != 'YES'"); $mail_to = ""; while ($row = mysql_fetch_array($query)){ echo $row['firstname']." - ".$row['email']."\n"; $mail_to = $row['email'].", "; } if (!empty($mail_to)){ sendEmail($mail_to); } } // SEND EMAIL function sendEmail($mail_to) { $from = "MyEmail@myemail.com"; $message = "Dear " . $row['firstname'].", <br><br>" ."You have the following bills due today.<br><br>" .$row['billname']. "<br><br>" ."Please login to pay your bills"; $headers = 'From: '.$from."\r\n" . 'Reply-To:'.$_POST['email']."\r\n" . "Content-Type: text/html; charset=iso-8859-1\n". 'X-Mailer: PHP/' . phpversion(); mail($mail_to, "Today is your due date", $message, $headers); } ?>
-
Alright so I have 3 pages. Signup, Password reset and Send message. All three pages/forms email to the recipient. So far my test have only been with hotmail and gmail. All emails go through for hotmail accounts. They show up in the hotmail. All emails DO go through for gmail accounts. But they don't show up in the gmail. The only page that gmail is able to receive emails from is "send message". The emails derived from that send message show up in gmail. The other two don't. There are not errors on the server side that show up. It clearly shows emails being sent. Does anyone have a clue why this is happening?
-
Why are my posts getting booted...? I just need help!!! Can someone help me getting multiple emails sent with PHP? I was able to get this to work with 1 recepient at a time, but not multiple. The other code on the forums I have not been able to get to work... can someone help with the below code? Many thanks function sentEmailSMTP2($email1, $email2) { $string2 = $email1. "@hotmail.com" . "," . $email2. "@hotmail.com"; $to = $string2; $from = "me@xxxxxxxxx.com"; $subject = 'messageX'; $message = 'Its ready'; $headers = 'From: me@xxxxxx.com' . "\r\n" . 'Reply-To: me@xxxxxx.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $host = "mail.xxxxxxx.com"; $username = "me@xxxxxxxx.com"; $password = "password"; $mail = new PHPMailer(); $mail -> IsSMTP(); // telling the class to use SMTP $mail -> SMTPAuth = true; $mail -> SMTPKeepAlive = true; $mail -> Host = $host; $mail -> Username = $username; $mail -> Password = $password; $mail -> SetFrom($from, 'Test '); $mail -> Subject = $subject; $mail -> AddAddress($string2); $mail -> Body = $message; if (!$mail -> Send()) { echo "Mailer Error (" . str_replace("@", "@", $string2) . ') ' . $mail -> ErrorInfo . '<br />'; } else { echo "Message sent to :" . $string2 . ' (' . str_replace("@", "@", $string2) . ')<br />'; } }