Jump to content

Multiple emails from one file


watts

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
Link to comment
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?

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.