Jump to content

Archived

This topic is now archived and is closed to further replies.

watts

Multiple emails from one file

Recommended Posts

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

Share this post


Link to post
Share on other sites
Yeah... just setup another call to mail().  The second call will have completely different details.

Share this post


Link to post
Share on other sites
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:

[code=php:0]
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";
    }
[/code]

and heres the code for the second instance:

[code=php:0]
      $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";
[/code]

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

Share this post


Link to post
Share on other sites

×

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.