Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

allowing email attachments to emailer in admin


Guest

Recommended Posts

I was hoping there was already a conribution out their, or something like it so I didn't have to write my own. One of my clients needs a mass emailer that is capable of sending out email attachements once a month from the admin section. I was wondering if someone already has some code, otherwise I will probably have to use part of PHPemailer to write a hack to do it.

 

Any feedback, I thought this would have been done by now.

 

-Ben Taylor

Link to comment
Share on other sites

The current email class used with oisC will send email as attachements. You will need to send the email something like this:

 

 

$send_fname = DIR_FS_ADMIN . BATCH_PDF_DIR . $Attachment_filename;
tep_mail($customers_name, $customers_email_address, EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $send_fname, $Attachment_filename, 'multipart/mixed');

 

I do not think I had to modify any other parts to acheive the attachemnt inclusion :)

 

cheers and HTH

 

Peter M

Peter McGrath

-----------------------------

See my Profile (click here) for more information and to contact me for professional osCommerce support that includes SEO development, custom development and security implementation

Link to comment
Share on other sites

sorry, I missed that I edited the includes/functions/general.php file as well,

 

replace the tep_mail function with:

 

  function tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address, $attachment_file = false, $attachment_name = false, $attachment_type =false)  {
if (SEND_EMAILS != 'true') return false;

// Instantiate a new mail object
$message = new email(array('X-Mailer: osCommerce'));

if ($attachment_file != false && $attachment_name != false && $attachment_type != false) {
   $attachments = $message->get_file($attachment_file);
   $message->add_attachment($attachments, $attachment_name, $attachment_type);
}

  // Build the text version
  $text = strip_tags($email_text);
  if (EMAIL_USE_HTML == 'true') {
 $message->add_html($email_text, $text);
  } else {
 $message->add_text($text);
  }


  // Send message
  $message->build_message();
  $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject, $headers);
}

Don't forget to backup first when doing all work ;)

 

Peter M

Peter McGrath

-----------------------------

See my Profile (click here) for more information and to contact me for professional osCommerce support that includes SEO development, custom development and security implementation

Link to comment
Share on other sites

Thanks for all of that. I'll get to work changing. This is such a great forum for finding answers to stuff. I think it's time for me to give back some of my contributions that I've done for employeers, but just haven't taken the time to make them a contribution package.

 

Thanks again.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...