Jump to content

php mime mail


cherylp

Recommended Posts

using php I am looking to send an automated email when a client signs up to my web page.  The catch is that I want to attach two PDF's for them to fill out.  I am using the following code to just send the email....

 

include('../mimemail/class.Email.php'); 

 

//** establish to,from, and any other recipiants.

 

$Sender = $email;

$Recipiant = $client_email2;

 

$Cc = "";

$Bcc = "";

 

//** create the text and HTML versions of the body content here.

 

 

ob_start();        //start output buffering

include ("emailbody.php");    //all output goes to buffer

$buf = ob_get_contents();    //assign buffer to a variable

ob_end_clean();        //clear buffer and turn off output buffering

 

 

 

 

      $textVersion = $comments;

              $htmlVersion = $buf;

 

  unset($msg);

 

 

//** !!!! SEND A MULTIPART/ALTERNATIVE EMAIL !!!!

//** create the new message using the to, from, and email subject.

 

  $msg = new Email($client_email2, $email, "Birddog Contact Form");

 

  $msg->Cc = $Cc;

  $msg->Bcc = $Bcc;

 

//** set the message to be a multiprat/alternative email. This allows for

//** multiple versions of same content.

//** NOTE: you cannot send attachments when a message is set to be

//**      multipart/alternative. there is also no way to switch

//**      back to normal multipart/mixed after this call.

 

  $msg->SetMultipartAlternative($textVersion, $htmlVersion);

 

//** send the email message.

 

  $SendSuccess = $msg->Send();

 

//** !!!! SEND A PLAIN TEXT EMAIL !!!!

/* create the new message using the to, from, and email subject.

 

  $msg = new Email($Recipiant, $Sender, "A Test Plain Text Email!");

  $msg->Cc = $Cc;

  $msg->Bcc = $Bcc;

 

//** set the message to be text only and set the email content.

 

  $msg->TextOnly = true;

  $msg->Content = $textVersion;

 

//** send the email message.

 

  $SendSuccess = $msg->Send();

 

  echo "Plain text email was ",

      ($SendSuccess ? "sent" : "not sent"), "<br>";

 

  unset($msg);*/

 

Does anyone know of a quick or easy adjustment to attach files?  I'll appreciate anyone's help on this.

Link to comment
Share on other sites

Used this to send CSVs as attachments, provided you've fopen()ed the files and stored them as attachments this should work.

 

--PHP-mixed-<?php echo $random_hash; ?> 
Content-Type: application/pdf ; name="file.pdf" 
Content-Transfer-Encoding: base64 
Content-Disposition: attachment 

<?php echo $attachment; ?>
--PHP-mixed-<?php echo $random_hash; ?>--

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.