arneb / django-campaign

Newsletter management app for Django
BSD 3-Clause "New" or "Revised" License
66 stars 19 forks source link

Integration issue with mandrill #4

Closed X17 closed 8 years ago

X17 commented 9 years ago

i am trying to implement via mandrill got stuck at this error

X17 commented 9 years ago

ValueError at /admin/campaign/campaign/1/send/ Empty module name Request Method: POST Request URL: http://foo_domain/admin/campaign/campaign/1/send/ Django Version: 1.7 Exception Type: ValueError Exception Value:
Empty module name Exception Location:***/local/lib/python2.7/site-packages/campaign/context.py in get_mail_processors, line 18

X17 commented 9 years ago

The issue is in context.py in get_mail_processors, line 18

for path in getattr(settings, 'CAMPAIGN_CONTEXT_PROCESSORS',('campaign.context_processors.recipient')): i = path.rfind('.') module, attr = path[:i], path[i+1:]

returns an empty value for path

if i put string directly it works. module, attr = 'campaign.context_processors','recipient_dict'

arneb commented 9 years ago

Which Django Version are you using? Please show your CAMPAIGN_CONTEXT_PROCESSORS setting (./manage.py diffsettings | grep CAMPAIGN for example).

X17 commented 9 years ago

CAMPAIGN_BACKEND = 'campaign.backends.mandrill_api' ### CAMPAIGN_CONTEXT_PROCESSORS = 'campaign.context_processors.recipient_dict' ### CAMPAIGN_FROM_EMAIL = 'foo@domain.com' ###

I followed the docs and comments in the mandrill.py

arneb commented 9 years ago

CAMPAIGN_CONTEXT_PROCESSORS = 'campaign.context_processors.recipient_dict'

This setting should be a tuple:

CAMPAIGN_CONTEXT_PROCESSORS = ('campaign.context_processors.recipient_dict',)
X17 commented 9 years ago

Ahhhh.... feeling kinda dumb.

Thanks for correcting me, though i worked it around but yeah this the correct way.

one last thing from where does it pick the sender's name, my guess is django_site but it's not picking the same.

arneb commented 9 years ago

one last thing from where does it pick the sender's name

By default it takes the sender name configured in the mandrill web user-interface (where you get your api key from). But you can override it with the following setting (I've included some more options as examples):

MANDRILL_API_SETTINGS = {
    "from_name": "My Sender Name",
    #"tracking_domain": "newsletter.mydomain.com",
    #"auto_text": False,
    #"auto_html": False,
    #"view_content_link": False,
    #"track_opens": True,
    #"important": False,
}
X17 commented 9 years ago

Is there any feature to add tags to separate campaigns / mailing list . if, not any suggestion how to go about it.

arneb commented 9 years ago

there is no feature to add tags and it is not planned to add such a feature. maybe you can use django-taggit to add tags.

X17 commented 9 years ago

Are you writing in reference to mandrill tags as their api supports tags which marks every mail. It gives easy access in order to filter mails in mandrill dashboard.

I am looking for http://help.mandrill.com/entries/28563573-How-do-I-use-tags-in-Mandrill

In Mandrill API https://mandrillapp.com/api/docs/messages.html, we send a request json. All i need is to add the following in the json request sent

"tags": [ "foo_value or Campaign_name or mailing_list_name" ],

If you could tell me how to access the campaign name or mailing list value in mandrill_api.py, i can tweak it in the json formed there.

arneb commented 9 years ago

ok, I misunderstood the question. I have to take a look into it ...

X17 commented 9 years ago

i have just now added few things into my previous comment for more clarity, have a look.

X17 commented 9 years ago

Suggestion : Tags will be passed just like the sender's name instead of hardcode if we can give dynamic

MANDRILL_API_SETTINGS = { "tags": ["foo_variable" ],

"from_name": "My Sender Name",

#"tracking_domain": "newsletter.mydomain.com",
#"auto_text": False,
#"auto_html": False,
#"view_content_link": False,
#"track_opens": True,
#"important": False,

}

X17 commented 9 years ago

@arneb any progress???

bashu commented 8 years ago

if someone interested here is another fork https://github.com/bashu/fluentcms-campaign

arneb commented 8 years ago

0.3.0 is now released