Jump to content
npn2531

Mail Manager

Recommended Posts

open includes/modules/mail_manager/order_confirm.php

 

to the list under '//define values for placeholder variables' add this:

$moneyorder_comments = MODULE_PAYMENT_MONEYORDER_TEXT_EMAIL_FOOTER;

Then change this:

//define placeholders
$placeholders=array('$storeurl', '$storename','$storeemail','$separator','$orderno','$orderdate','$invoiceurl','$productsorderedhead','$productsordered','$deliveryaddresshead','$deliveryaddress','$billingaddresshead', '$billingaddress', '$paymentmethodhead', '$paymentmethod', '$paymentclass','$ordercomments', '$ordertotalhead', '$ordertotal');
$values=array(HTTP_SERVER,STORE_NAME,STORE_OWNER_EMAIL_ADDRESS,EMAIL_SEPARATOR, $order_no,$order_date, $invoice_url,EMAIL_TEXT_PRODUCTS,$products_ordered, EMAIL_TEXT_DELIVERY_ADDRESS,$delivery_address, EMAIL_TEXT_BILLING_ADDRESS, $billing_address, EMAIL_TEXT_PAYMENT_METHOD, $method_of_payment,$payment_class, $order_comments,$ordertotal_head,$ordertotal);

to this:

$placeholders=array('$storeurl', '$storename','$storeemail','$separator','$orderno','$orderdate','$invoiceurl','$productsorderedhead','$productsordered','$deliveryaddresshead','$deliveryaddress','$billingaddresshead', '$billingaddress', '$paymentmethodhead', '$paymentmethod', '$paymentclass','$ordercomments', '$ordertotalhead', '$ordertotal', '$moneyordercomments');
$values=array(HTTP_SERVER,STORE_NAME,STORE_OWNER_EMAIL_ADDRESS,EMAIL_SEPARATOR, $order_no,$order_date, $invoice_url,EMAIL_TEXT_PRODUCTS,$products_ordered, EMAIL_TEXT_DELIVERY_ADDRESS,$delivery_address, EMAIL_TEXT_BILLING_ADDRESS, $billing_address, EMAIL_TEXT_PAYMENT_METHOD, $method_of_payment,$payment_class, $order_comments,$ordertotal_head,$ordertotal, $moneyorder_comments);

 

This adds a new placeholder, $moneyordercomments, that you can use in the order_confirm email. Note that the \n in the money order language file are 'text' line breaks, you may have to replace them with html line breaks <br>.

If it does not work then run this test to see if it is all the punctuation in that langauge definition that is a issue.

 

in the language file change:

define('MODULE_PAYMENT_MONEYORDER_TEXT_EMAIL_FOOTER', "Make Payable To:\nBank: ". OWNER_BANK_NAME . "\nOwner of an account: ". OWNER_BANK_ACCOUNT . "\nBank code number: ". STORE_OWNER_BLZ . "\nAccount number: ". OWNER_BANK . "\nSWIFT Code: ". OWNER_BANK_SWIFT . "\nIBAN: ". OWNER_BANK_IBAN . "\n\nnSend To:\n" . STORE_NAME_ADDRESS . "\n\n" . 'Your order will not ship until we receive payment.');

 

to this:

define('MODULE_PAYMENT_MONEYORDER_TEXT_EMAIL_FOOTER', 'It is the stuff in the language file that is an issue');

Edited by npn2531

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Share this post


Link to post
Share on other sites

After editing the and uploading files, I used myphpadmin to import the database file but I received the error message below;

 

Error

 

SQL query:

 

--

-- Database: `alphacle_osc10`

--

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

--

-- Table structure for table `mm_bulkmail`

--

CREATE TABLE IF NOT EXISTS `mm_bulkmail` (

`bulkmail_id` int( 11 ) NOT NULL AUTO_INCREMENT ,

`title` varchar( 255 ) NOT NULL ,

`htmlcontent` text NOT NULL ,

`txtcontent` text NOT NULL ,

`date_added` datetime NOT NULL ,

`date_sent` datetime DEFAULT NULL ,

PRIMARY KEY ( `bulkmail_id` )

) ENGINE = MYISAM DEFAULT CHARSET = utf8 AUTO_INCREMENT =1;

 

MySQL said: Documentation

#1046 - No database selected

 

Please help.

Share this post


Link to post
Share on other sites

It is not clear to me from the above what happened, but it appears from the error msg that you somehow did not select the database. Be sure you are importing this file, mail_manager_DB__.sql. Once you are in phpMyAdmin, select the database you are working with, then select the import tab. It should work.


Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Share this post


Link to post
Share on other sites

It is not clear to me from the above what happened, but it appears from the error msg that you somehow did not select the database. Be sure you are importing this file, mail_manager_DB__.sql. Once you are in phpMyAdmin, select the database you are working with, then select the import tab. It should work.

 

 

I imported it, could it be that the database is damaged?

Share this post


Link to post
Share on other sites

I imported it, could it be that the database is damaged?

I doubt it is damaged as others have successfully used that same file. I am assuming you are getting from here http://addons.oscommerce.com/info/8120

 

What does seem odd is all the extraneous info in your error message. What should happen is just this:

CREATE TABLE IF NOT EXISTS `mm_bulkmail` (
`bulkmail_id` int( 11 ) NOT NULL AUTO_INCREMENT ,
`title` varchar( 255 ) NOT NULL ,
`htmlcontent` text NOT NULL ,
`txtcontent` text NOT NULL ,
`date_added` datetime NOT NULL ,
`date_sent` datetime DEFAULT NULL ,
PRIMARY KEY ( `bulkmail_id` )


Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Share this post


Link to post
Share on other sites

I doubt it is damaged as others have successfully used that same file. I am assuming you are getting from here http://addons.oscommerce.com/info/8120

 

What does seem odd is all the extraneous info in your error message. What should happen is just this:

CREATE TABLE IF NOT EXISTS `mm_bulkmail` (
`bulkmail_id` int( 11 ) NOT NULL AUTO_INCREMENT ,
`title` varchar( 255 ) NOT NULL ,
`htmlcontent` text NOT NULL ,
`txtcontent` text NOT NULL ,
`date_added` datetime NOT NULL ,
`date_sent` datetime DEFAULT NULL ,
PRIMARY KEY ( `bulkmail_id` )

 

 

Thanks for your help, I have successfully added it but is unable to carry out these tasks;

 

1. Create a new field, mmstatus, in the Database in the customers table. The mmstatus.sql file contains command to use in phpmyadmin to create this. This command is posted below:

ALTER TABLE `customers` ADD `mmstatus` CHAR( 2 ) NOT NULL AFTER `customers_newsletter`

 

2. The invoice to the customer is bearing the template e-mail address and address, how can I change this? also I am not receiving sales alert or email after sales. Please how can I edit the template to add store information and also receive email sales alert.

Share this post


Link to post
Share on other sites

Thanks for your help, I have successfully added it but is unable to carry out these tasks;

 

1. Create a new field, mmstatus, in the Database in the customers table. The mmstatus.sql file contains command to use in phpmyadmin to create this. This command is posted below:

ALTER TABLE `customers` ADD `mmstatus` CHAR( 2 ) NOT NULL AFTER `customers_newsletter`

 

2. The invoice to the customer is bearing the template e-mail address and address, how can I change this? also I am not receiving sales alert or email after sales. Please how can I edit the template to add store information and also receive email sales alert.

Share this post


Link to post
Share on other sites

The only overlap would possibly be the mailbeez review letter and the mail manager sale_followup letter. Both are mailing out to customers who recently ordered, and include product links and product review links. The main query in the sale_followup is an adaptation of your query in the review letter. Also tep_mm_sendmail is a direct adaptation of mailbeez's osc_sendEmail function.

 

Mail Manager differs in that it is a program that manages and templates all the existing mail functions in OSCommerce from the admin. It does add the excell functions and bulk mail features, but it is tied really close to OSCommerce's existing programming and structure. It would not be adaptable to ZenCart for example, as Mailbeez is.

Edited by npn2531

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Share this post


Link to post
Share on other sites

This looks great, but i have one question. When you send out the marketing bulk mail, who does it send the emails too? Just people that have requested to be in the newsletter or all customers. Also, does the customer have the ability to opt-out if they dont want to receive the marketing emails any longer?

 

Evan

Share this post


Link to post
Share on other sites

The emails can be sent to newsletter subscribers, all customers, or customers who recently ordered. It only takes a click in the admin to switch out the target groups. If you can write a simple php query you can easily create custom groups of email recipients.

 

There is no automatic opt out, you have to add an 'unsubscribe' link to the emails. Examples are included in the installation.


Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Share this post


Link to post
Share on other sites

I got this module installed and I am trying to test a bulk mail campaign, but is it possible to insert placeholders into the template? I would like to have first name, last name and email address in the template so that I can have an link to unsubscribe a person that does not want to receive the newsletters in the future.

Share this post


Link to post
Share on other sites

Yes, the placeholders will work even if you hardcode them into the templates. However, note that all templates work for all emails, but placeholders are specific to email types. For example the placeholder $invoiceurl works on the order confirmation email, but not on the create account email, as there is simply no invoice involved in the creation of a new account, but both these email types can use the same template.


Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Share this post


Link to post
Share on other sites

George-

 

I have the response mails working wonderfully. I was actually referring to the bulkmail manager newsletters. Is it possible to include placeholders in those? If so, can you demonstrate what I would need to do in order to see the first name, last name and email included as I have not been able to figure it out for the life of me. Thanks for your help.

 

Best Regards,

 

Evan

Share this post


Link to post
Share on other sites

I figured out how to get the placeholder to show in the bulk manager emails. In this example, I wanted to show the following placeholders:

 

$customerfirstname

$customerlastname

$customeremail

 

I modified the send loop which is around line 390 in mm_bulkmail.php in the admin directory.

 

Here is the code that I used:

 

   //start mailing loop
   if($mail['mmstatus']=='0'){

  $fname = $mail['customers_firstname'];
  $lname = $mail['customers_lastname'];
  $email = $mail['customers_email_address'];

  $placeholders=array('$customerfirstname','$customerlastname','$customeremail');
	 $values=array($fname,$lname,$email); 

  $output_content_html = str_replace($placeholders, $values, $output_content_html);

 tep_mm_sendmail($mail['customers_firstname'].' '.$mail['customers_lastname'], $mail['customers_email_address'], STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $newsletter['subject'], $output_content_html, $output_content_txt);
 //$email = $mail['customers_email_address'];

Share this post


Link to post
Share on other sites

Hello!

I'am not very good in integrating contributions at all but I tried that one.

I followed all the steps and uploaded all new folders

I use German language as well so I did all changes which should be done in english in german as well.

 

First I checked my frontpage and it seems fine. When I creat a new account I get mails an also for the order conformation.

then I tried to login in the admin ........and here it stops.....I only got the error: Error: Invalid administrator login attempt.

 

Has anyone an idea why this could be?

Edited by Jan Zonjee

Share this post


Link to post
Share on other sites

Hi,

how to integrate mail manager with ACTIVATE ACOUNT PASSWORD addon???

 

Selecting "Create Account" template goes right and also the email arrives to customer. But there is no code to activate the account.

 

The activate account code of the other contribution is in /create_account.php

But we must adapt the code in DIR_WS_MODULES.'mail_manager/create_account.php

 

The code itself is (/create_account.php):

$activation_id = md5($email_address);
$verification_href = tep_href_link(FILENAME_ACCOUNT_ACTIVATE, 'activation_id=' . $activation_id, 'SSL');
$verification_mail = tep_href_link(FILENAME_ACCOUNT_ACTIVATE, 'activation_id=' . $activation_id . '&submit=true&activation_code=' . $activation_code, 'SSL');
$verification_link = '<a href="' . $verification_mail . '">' . $verification_mail . '</a>' ."\n\n";
$email_text .= EMAIL_WELCOME . TEXT_ACTIVATION_CODE . " <b>" . $activation_code . "\n\n" . "</b>" . $activation_text . $verification_link . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;



tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

On DIR_WS_MODULES.'mail_manager/create_account.php:

//define placeholders
$placeholders=array('$storeurl', '$storename','$storeemail','$customername', '$mmgreet','$mmwelcome','$email_text','$mmtext','$mmcontact','$mmwarning');
$values=array(HTTP_SERVER,STORE_NAME,STORE_OWNER_EMAIL_ADDRESS,$name,$mmgreet, EMAIL_WELCOME,$email_text,EMAIL_TEXT,EMAIL_CONTACT,EMAIL_WARNING);
$output_content_html=str_replace($placeholders, $values, $output_content_html);
$output_content_txt=str_replace($placeholders, $values, $output_content_txt);



//send email	 
tep_mm_sendmail($name, $email_address, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, $output_subject, $output_content_html, $output_content_txt);    

 

I tried diferent ways to integrate the $email_text , but allways arrives empty to customer.

Share this post


Link to post
Share on other sites

For the moment i get working.

I paste the code for future releases:

On DIR_WS_MODULES.'mail_manager/create_account.php:

//define values for placeholder variables
$mmwelcome = EMAIL_WELCOME;
$mmcode = EMAIL_CODE;
$mmtext = EMAIL_TEXT;
$mmcontact = EMAIL_CONTACT;
$mmwarning = EMAIL_WARNING;

// contact US IP recorder
//IP recorder start
$ipaddress = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$ip = "\n\n IP: " . $ipaddress;
$REMOTE_ADDR = $HTTP_SERVER_VARS["REMOTE_ADDR"];
// $content = $HTTP_POST_VARS['enquiry'];
// $content_ip = $content . $ip;
// $enquiry = tep_db_prepare_input($content_ip);
//IP recorder end
// contact US IP recorder

//define placeholders
// CODE FROM ACTIVATE ACCOUNT CODE
$activation_id = md5($email_address);
$verification_href = tep_href_link(FILENAME_ACCOUNT_ACTIVATE, 'activation_id=' . $activation_id, 'SSL');
$verification_mail = tep_href_link(FILENAME_ACCOUNT_ACTIVATE, 'activation_id=' . $activation_id . '&submit=true&activation_code=' . $activation_code, 'SSL');
$verification_link = '<a href="' . $verification_mail . '">' . $verification_mail . '</a>' ."\n\n";
$email_text_code .= CODIGO_DE_ACTIVACION . " <b>" . $activation_code . "\n\n" . "</b><br>" . $activation_text . $verification_link;

$placeholders=array('$storeurl', '$storename','$storeemail','$customername', '$mmgreet','$mmwelcome','$email_text_code','$mmtext','$mmcontact','$mmwarning');
$values=array(HTTP_SERVER,STORE_NAME,STORE_OWNER_EMAIL_ADDRESS,$name,$mmgreet, EMAIL_WELCOME,$email_text_code, EMAIL_TEXT,EMAIL_CONTACT,EMAIL_WARNING);
$output_content_html=str_replace($placeholders, $values, $output_content_html);
$output_content_txt=str_replace($placeholders, $values, $output_content_txt);

//send email	  
tep_mm_sendmail($name, $email_address, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, $output_subject, $output_content_html, $output_content_txt, $ip);    

//if mail manager status update email is 'inactive' process normally via oscommerce
}else{                        

  tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $ip);
   }

?>

 

Then modify database template:

add to mmresponsemail > htmlcontent

<p style="font-family: Verdana, sans-serif; font-size: 12px; line-height: 16px; color: #666666; margin: 10px;">$mmgreet<br/>$mmwelcome</p>
<p style="font-family: Verdana, sans-serif; font-size: 12px; line-height: 16px; color: #666666; margin: 10px;">$email_text_code</p>
<p style="font-family: Verdana, sans-serif; font-size: 12px; line-height: 16px; color: #666666; margin: 10px;">$mmtext</p>

add to mmresponsemail > txtcontent

$mmgreet

$mmwelcome

$email_text_code

$mmtext

$mmcontact

$mmwarning

Share this post


Link to post
Share on other sites

Now it works - the only thing I have is that instead having a button between Modules and Customers I have this: BOX_HEADING_MAIL_MANAGER

at the top (over Konfiguration)

Any idea what i have to change? I use oscommerce 2.3.1

Edited by Jan Zonjee

Share this post


Link to post
Share on other sites

what a great contrib! gratulation! that's a really usefull and great made thing.

 

i have some questions/problem: (excuse my english)

  1. i know, there was some talking about placeholders. i would like to begin all response mails with names like "Hello Peter Smith". but in order-confirm and status-update mail, i couldn't. who knows how i can do that?
  2. is there a possibility to write html emails to single customers (send email) only by typing words without html coding? when i change writing on a new line, it will be ignored when the mail is sended. or is there a wysiwyg editor for input fields? allwas write html codes for personal mails is to much work...
  3. if i would integrate the xsell contrib. where and how can i integrate the recommendet things and the asking for comments? in all mails? bulkmail? order confirm?

thank you for answering my questions!

Share this post


Link to post
Share on other sites

The bulkmail manager inside the mail manager has a newsletter already installed called 'thank you' that is integrated with the xsell contrib. It will mail out to emails on recent orders and add images and links of recently purchased items, and the cross-sold items.

 

Look at the 'email manager' (admin>mail manager>send email). It will send out single templated emails to selected customers. It also has a feature for quickly selecting customers from the database.

 

In the order-confirm and the status-update mail the placeholder '$customername' should give you the customer name.


Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Share this post


Link to post
Share on other sites

After installing it the Mail Manager account_notifications.php stopped to work.

 

Im thinking is related to this contribution.

 

After unmark the products and press CONTINUE (to delete them from the database). It goes to the account page and says "OK. Product notification deleted", but after returning to account_notifications.php the products remains there (didnt delete!).

Share this post


Link to post
Share on other sites

Fillally get to work with account_notifications ans newsletters_products modlule.

 

My question now,

how to get working with this contribution:

Send email to customers with an attachment included

http://addons.oscommerce.com/info/4583

 

Especially here:

And replace with:
   $from = tep_db_prepare_input($HTTP_POST_VARS['from']);
   $subject = tep_db_prepare_input($HTTP_POST_VARS['subject']);
   $message = tep_db_prepare_input($HTTP_POST_VARS['message']);

   //Let's build a message object using the email class
   $mimemessage = new email(array('X-Mailer: osCommerce'));

   if ($_FILES['userfile']['size'] > 0) { 

	  $attachment_name   = $HTTP_POST_FILES['userfile']['name'];
	  $attachment_type   = $HTTP_POST_FILES['userfile']['type'];
     //$attachment_size = $HTTP_POST_FILES['userfile']['size']; //Just in case you want to check and limit the size
	  new upload('userfile', DIR_FS_DOWNLOAD);
	  $attachment_file   = DIR_FS_DOWNLOAD . $attachment_name;
	  $attachments	   = $mimemessage->get_file($attachment_file);
         $mimemessage->add_attachment($attachments, $attachment_name, $attachment_type);
  }

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

   $mimemessage->build_message();
   while ($mail = tep_db_fetch_array($mail_query)) {
  $mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', $from, $subject);
   }

   tep_redirect(tep_href_link(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to)));


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×