Jump to content


Photo

Multiple emails from one file


  • Please log in to reply
2 replies to this topic

#1 watts

watts
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 28 September 2006 - 08:14 PM

Hi,
I'm working on a page where you can email yourself a bunch of images that you selected and put in a lightbox (kind of like a shopping cart but no checkout).  I have that part working fine using phpMailer but I want it to also send an email to the administrator with the person's email adress and a list of the image numbers they selected.  I don't want to BCC because I don't want to send the actual images (like I do to the customer) I just want to send a list of image numbers.  Is there a way that I can send two different emails from the same file?

Thanks

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 28 September 2006 - 08:25 PM

Yeah... just setup another call to mail().  The second call will have completely different details.

Info: PHP Manual


#3 watts

watts
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 29 September 2006 - 04:31 PM

I'm actually using phpMailer so the call is a little different.  I've tried to just set up another instance but nothing happens.  I don't get an error but I don't get the second email.  The code for the first instance is:

require("class.phpmailer.php");

    $mail = new PHPMailer();

    $mail->IsSMTP(); // telling the class to use SMTP
    $mail->Host = "smtp.server"; // SMTP server

    $mail->From = "admin@domain.com";
    $mail->FromName = "Kristin Lai";
    $mail->AddAddress("$ToAddress");

    $mail->Subject = "Your lightbox";
    $mail->Body = "If you are interested in purchasing any of the attached images please <a href='http://www.domain.com/order.php'>contact us</a> and include the filenames in your email.";
    $mail->AltBody="If you are interested in purchasing any of the attached images please contact us at address@domain.com and include the filenames in your email.";

    if(!$mail->Send())
    {
      echo "<div id='eMessage'>\n";
      echo "Email was not sent\n";
      echo "Mailer Error: " . $mail->ErrorInfo;
      echo "</div>\n";

    } else {
      echo "<div id='eMessage'>\n";
      echo "Your lightbox has been sent\n";
      echo "</div>\n";
    }

and heres the code for the second instance:

      $mail = new PHPMailer();
      $mail->IsSMTP();
      $mail->Host = "smtp.server";
      $mail->FromAddress = "admin@domain.com";
      $mail->FromName = "Stocksite";
      $mail->AddAddress("client@domain.com");
      $mail->Subject = "Lightbox Request";
      $mail->Body = "The following images have been sent to $ToName at $ToAddress: $imageList";

So I guess the question is, is there something else I should be adding or does phpMailer not allow for two instances?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users