PHP Classes

Combining several of your scripts

Recommend this page to a friend!

      MIME E-mail message sending  >  MIME E-mail message sending package blog  >  How Can PHP Send Emai...  >  All threads  >  Combining several of your scripts  >  (Un) Subscribe thread alerts  
Subject:Combining several of your scripts
Summary:Problem joining the functions
Messages:8
Author:Blair Millen
Date:2006-09-15 09:54:11
Update:2006-09-16 17:02:24
 

  1. Combining several of your scripts   Reply   Report abuse  
Picture of Blair Millen Blair Millen - 2006-09-15 09:54:11
Hi Manuel,

I wonder if you could assist me?

I'm trying to combine a few of your functions. Ultimately I would like to send out bulk HTML newsletters which are personalised in two ways:

1. I want to address them by their first name
2. I also want to serve up a simplified HTML version by stripping out "img" and "div" tags for people who prefer simple emails rtaher than full-blown HTML emails

I amended the "$to" array by adding in if their preference was for simple or fancy emails but when it send out emails it produces a single type (the last one in the array). This 'cache_body' functions looks the reason for using the single type, so I tried commenting out the 'cache_body' bits but the function requires a 'body part'. What do you suggest?

  2. Re: Combining several of your scripts   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2006-09-15 21:17:30 - In reply to message 1 from Blair Millen
Take a look at the test_smarty_personalized_mailing.php example.

If you do not want to use Smarty to generate the message body parts, just replace the Smarty objects fetch() function call by a value that defines the content for each message body parts.

  3. Re: Combining several of your scripts   Reply   Report abuse  
Picture of Blair Millen Blair Millen - 2006-09-15 21:29:56 - In reply to message 1 from Blair Millen
Thanks for the response Manuel. I'll look into the Smarty objects tomorrow and give you an update.

  4. Re: Combining several of your scripts   Reply   Report abuse  
Picture of Blair Millen Blair Millen - 2006-09-16 07:44:01 - In reply to message 1 from Blair Millen
Thanks for the response Manuel. I'll look into the Smarty objects tomorrow and give you an update.

  5. Re: Combining several of your scripts   Reply   Report abuse  
Picture of Blair Millen Blair Millen - 2006-09-16 11:35:50 - In reply to message 2 from Manuel Lemos
Hi again Manuel,

I've attempted using the Smarty approach but now I'm having trouble knowing where to put the templates. I'm getting the default error message of:

"Please copy the template file templates/mailing.html.tpl to your Smarty templates directory"

This is file structure:

> smarty
>templates
>templates_c
>configs
>libs
>Smarty.class.php

Any ideas what I'm doing wrong?

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

I'm not sure if I understand correctly: do I need to install all the Smarty files on my server or do I just need the Smarty class file? The server my client has doesn't allow root access so if it involves a full upload of all the Smarty files then that option is not going to work for me.

If this is the case, can you possibly explain with an example of how to implement your class by replacing the Smarty objects fetch() function call with a value for each message body part?

Thanks

  6. Re: Combining several of your scripts   Reply   Report abuse  
Picture of Blair Millen Blair Millen - 2006-09-16 12:04:19 - In reply to message 2 from Manuel Lemos
Hi again Manuel,

I've attempted using the Smarty approach but now I'm having trouble knowing where to put the templates. I'm getting the default error message of:

"Please copy the template file templates/mailing.html.tpl to your Smarty templates directory"

This is file structure:

> smarty
>templates
>templates_c
>configs
>libs
>Smarty.class.php

Any ideas what I'm doing wrong?

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

I'm not sure if I understand correctly: do I need to install all the Smarty files on my server or do I just need the Smarty class file? The server my client has doesn't allow root access so if it involves a full upload of all the Smarty files then that option is not going to work for me.

If this is the case, can you possibly explain with an example of how to implement your class by replacing the Smarty objects fetch() function call with a value for each message body part?

Thanks

  7. Re: Combining several of your scripts   Reply   Report abuse  
Picture of Blair Millen Blair Millen - 2006-09-16 12:06:05 - In reply to message 6 from Blair Millen
Apologies for the double postings, I've got a session saver which refreshes the page when I re-open the browser.

  8. Re: Combining several of your scripts   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2006-09-16 17:02:24 - In reply to message 5 from Blair Millen
My suggestion was for you to take a look at that example as basis for doing what you want.

So, if you do not want to use Smarty, there is no problem. Just remove the statements that use the Smarty object calls and replace where it uses the Smarty fetch() function by some value that defines your message body part text.