Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with pmdatadir #4

Open
shhariprasadsh opened this issue May 27, 2014 · 8 comments
Open

problem with pmdatadir #4

shhariprasadsh opened this issue May 27, 2014 · 8 comments

Comments

@shhariprasadsh
Copy link

Hi,
I was looking for a bulk mailer for my CMS and I downloaded Personalized Mailer. As instructed I installed sparks manager and it worked fine. Then I installed personalized mailer and initialized like this

function send_bulk_mail(){
        $this->load->spark('PersonalizedMailer/1.0.3'); 
        $this->load->library('personalizedmailer',array(
            'pmdatadir' => '/log',
            'domain'    =>  'intern'        
        ));
        // mail ids
        $addresses = array(
            '[email protected]',
            '[email protected]',
            '[email protected]',
            '[email protected]',
            '[email protected]',
            '[email protected]' 
        );

        $names = array(
            'Hari',
            'Nandhu',
            'Bigil',
            'Praveen',
            'Hariprasad',
            'Saravana'      
        );

        $groups = array(
            'A',
            'B',
            'C',
            'D',
            'E',
            'F'     
        );

        $msgtemplate = "<p>Hello [name],<br/>

            This is an <strong>HTML</strong> message. You have been assigned to group: [group]</p>";

        // initialize a queue
        $this->personalizedmailer->initqueue(array(
            'addresses' =>  $addresses,
            'msgtemplate' => $msgtemplate,
            'subject' => 'Test Message',
            'fromname' => 'Test Person',
            'fromaddr' => '[email protected]',
            'HTML' => true,
            'loopdelay' => 0.75,
            'varsearch' => array('[name]', '[group]'),
            'varreplace' => array($names, $groups)
        ));
    }

The 'log' directory mentioned here is created inside the library where the personalizedmailer.php resides. The log directory permission is set to 777. But when I run the code it shows the following error

ERROR: missing personalized message lib working directory for staging mailings

I suppose this is because of the pmdatadir I have created . Please help me out.

Thank you
Hariprasad S H

@shhariprasadsh
Copy link
Author

any help ????

@joeauty
Copy link
Owner

joeauty commented May 27, 2014

Do you really have a /log directory at the root of your OS filesystem? You'll need root permissions to create that directory. The path is not relative to your website.

@shhariprasadsh
Copy link
Author

Hi Joe,
Thanks a lot for the update... Actually the problem was with the path of the pmdatadir. The whole thing worked now but it got a small problem. The mails were sent but it shows a warning like this

A PHP Error was encountered

Severity: Warning

Message: in_array() expects parameter 2 to be array, null given

Filename: libraries/personalizedmailer.php

Line Number: 165

My function is given below

function send_bulk_mail(){
        $this->load->spark('PersonalizedMailer/1.0.3'); 
        $this->load->library('personalizedmailer',array(
            'pmdatadir' => '../intern/mail',
            'domain'    =>  'devintern'     
        ));
        // mail ids
        $addresses = array(
            '[email protected]',
            '[email protected]',
            '[email protected]',
            '[email protected]',
            '[email protected]',
            '[email protected]' 
        );

        $names = array(
            'Hari',
            'Nandhu',
            'Bigil',
            'Praveen',
            'Hariprasad',
            'Saravana'      
        );

        $groups = array(
            'A',
            'B',
            'C',
            'D',
            'E',
            'F'     
        );

        $msgtemplate = "<p>Hello [name],<br/>

            This is an <strong>HTML</strong> message. You have been assigned to group: [group]</p>";

        // initialize a queue
        $this->personalizedmailer->initqueue(array(
            'addresses' =>  $addresses,
            'msgtemplate' => $msgtemplate,
            'subject' => 'Test Message',
            'fromname' => 'Test Person',
            'fromaddr' => '[email protected]',
            'HTML' => true,
            'loopdelay' => 0.75,
            'varsearch' => array('[name]', '[group]'),
            'varreplace' => array($names, $groups)
        ));
        if ( !isset($_SERVER['argv'])) exit('CLI access only');             

                $this->personalizedmailer->sendtolist();
    }

@joeauty
Copy link
Owner

joeauty commented May 28, 2014

I'm glad to have helped!

Your function should be invoked via the command line, not via a web browser. The whole point of this Spark is to provide command line triggered mail list functions that can be controlled a little better than big jobs can be controlled via a web interface.

Are you familiar with how CodeIgniter can be used via the command line? It's actually really easy.

@shhariprasadsh
Copy link
Author

Nope can you help me out?

@joeauty
Copy link
Owner

joeauty commented May 28, 2014

Sure! Have you looked at this page yet? http://ellislab.com/codeigniter/user-guide/general/cli.html

@shhariprasadsh
Copy link
Author

yes I was going through that documentation. Actually my need is , I have a list of users in the admin panel of my CMS. I want to send mails to the selected contacts. Can I accomplish that using this? Please excuse me if the question seem silly. I am a novice in codeigniter thats why :)

@joeauty
Copy link
Owner

joeauty commented May 28, 2014

Sure, you can pull the addresses and all other data from your database, it's just that your "send now" button, so to speak, has to be invoked via the command line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants