Jump to content

Help with mail script


bartalen

Recommended Posts

Good day ...

 

I need some help making my script...

 

I have a database, with different tables:

Receivers

Submissions

 

____________________________________________________________________________________

Now i have an array with of al the submissions.:

[checkbox-id] Submitted by: Company Phone Email Subject Date/time Update Status (message in db)

[checkbox-id] Submitted by: Company Phone ..................

...............................

SEND BUTTON

____________________________________________________________________________________

 

if the send button is pushed, i want that he send tha message thats in the record from the Submissions to al the receivers in the receivers table....

 

 

This is the array:

      <?php
include("db_config.php");

$query = "SELECT * FROM Submissions ";
$result = mysql_query($query);
$num = mysql_num_rows ($result);
mysql_close();
if ($num > 0 ) {
$i=0;
while ($i < $num) {
$id = mysql_result($result,$i,"ID");
$companyname = mysql_result($result,$i,"companyname");
$name = mysql_result($result,$i,"name");
$phone = mysql_result($result,$i,"phone");
$email = mysql_result($result,$i,"email");
$subject = mysql_result($result,$i,"subject");
$website = mysql_result($result,$i,"website");
$stamp = mysql_result($result,$i,"stamp");
$status = mysql_result($result,$i,"status");
$ip = mysql_result($result,$i,"ip");


print "<table width=\"1024\" border=\"0\" >
         <tr>
<td width=\"58\"><input name=\"ID\" type=\"checkbox\" value=\"$ID\" /></td>
    <td width=\"130\">$name</td>
    <td width=\"119\">$companyname</td>
    <td width=\"104\">$phone</td>
    <td width=\"146\">$email</td>
    <td width=\"214\">$subject</td>
    <td width=\"156\">$stamp</td>
    <td width=\"58\"><a href=\"processes/submissions/update.php?id=$id\">Update</a></td>
    <td width=\"63\">$status</td>
  </tr>
      </table>
";
++$i; } } else { echo "No submissions in the database"; }?>

 

This is my mail class...

<?php
require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->SMTPDebug = 2;
$mail->IsSMTP();                                      // set mailer to use SMTP
$mail->Host = "mail.*******.com";  // specify main and backup server
$mail->SMTPAuth = "true";     // turn on SMTP authentication
$mail->Username = "******@******.com";  // SMTP username
$mail->Password = "****"; // SMTP password

$mail->From = "*****@****.com";
$mail->FromName = "Mailer";
$mail->AddAddress("");

$mail->AddAddress("***.**@***.be");                  // name is optional
$mail->AddReplyTo("****@****.com", "****");

$mail->WordWrap = 50;                                 // set word wrap to 50 characters
$mail->AddAttachment("");         // add attachments
$mail->AddAttachment("");    // optional name
$mail->IsHTML(true);                                  // set email format to HTML

$mail->Subject = "Here is the subject";
$mail->Body    = "This is the HTML message body <b>in bold!</b>";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";

if(!$mail->Send())
{
   echo "Message could not be sent. <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}

echo "Message has been sent";
?>

 

How you can help me...

 

Kind regards, Bart Devroey

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.