Campaign Template

Philip

Member
Hi all,

I have Mailwizz 1.3.5.2.

Is it possible to insert in the campaign template, codes to retrieve data from a remote database? Because I need to customize the email content to each subscriber.
Otherwise, could someone please advise what I should be doing instead, thank you!


Specifically, I need to do these:

1) send emails to customers according to their whether they have subscribed and their preferred frequencies e.g. once a week or once a month
What I have done:
- set up a subscriber list called "subscribers"
- set up custom fields with their subscribe value and frequency value
- set up segments for people who have subscribed and prefer once a month; people who have subscribed and prefer once a week; people who have no preference
- then i'll set up campaigns for each of these segments
- every week/month, i'll duplicate the relevant campaign and set a time for it to be sent

2) regarding the email content, i need to customize it according to further preferred values of the subscriber's e.g. they prefer to receive contents that are under certain categories (beauty / health / education) and receive contents about products that are within certain price range (all / less than $100 / $100-200).
This point 2 is the reason for my question above.
 

Rob

Active Member
You could look into using something like www.zapier.com to inject content into custom fields via the MW API based on actions/triggers which is then picked up using a content tag in the email template.

Not sure if it is possible but you never know.
 

Philip

Member
Thanks Rob, will KIV that.

Can someone give a more specific example of how I can get the values from the json to appear in the campaign email?

1) My json file is as follows, I've tested it and it works:

$return_arr = array();
$fetch = mysql_query("
SELECT cus_id, cus_email
FROM customers");

while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {
$row_array['cus_id'] = $row['cus_id'];
$row_array['cus_email'] = $row['cus_email'];

array_push($return_arr,$row_array);
}

echo json_encode($return_arr);

2) On the campaign setup tab, I have enabled "json feed".

3) The template part is where I'm stuck. I have copied pasted the example given by mailwizz:

<!DOCTYPE html>
<html>
<head>
<title>JSON FEEDS</title>
<meta http-equiv="content-type" content="text/html"><meta name="charset" content="utf-8">
</head>
<body>[JSON_FEED_BEGIN url='THIS_I_HAVE_CHANGED_TO_MY_URL' count='2']
<table>
<tbody>
<tr>
<td>
<p>[JSON_FEED_ITEM_CONTENT]</p>
</td>
</tr>
</tbody>
</table>
[JSON_FEED_END] [UNSUBSCRIBE_URL], [COMPANY_FULL_ADDRESS]</body>
</html>

4) However, when I open the email received, it is:

[JSON_FEED_BEGIN url='THIS_I_HAVE_CHANGED_TO_MY_URL' count='2']

[JSON_FEED_ITEM_CONTENT]

[JSON_FEED_END]
 
Last edited:

twisted1919

Administrator
Staff member
mailwizz extents a "content" key in your json, so you should try:
Code:
$return_arr = array();
$fetch = mysql_query("
SELECT cus_id, cus_email
FROM customers"); 

while ($row = mysql_fetch_array($fetch, MYSQL_ASSOC)) {
$row_array = array();
$row_array['content'] = $row['cus_id'] . ' -- ' . $row['cus_email'] ;

array_push($return_arr,$row_array);
}

echo json_encode($return_arr);
This way, when you enter:
Code:
[JSON_FEED_BEGIN url='THIS_I_HAVE_CHANGED_TO_MY_URL' count='2']

[JSON_FEED_ITEM_CONTENT]

[JSON_FEED_END]
The "[JSON_FEED_ITEM_CONTENT]" tag will actually be replaced with the "content" key of the json feed.

A full json feed example is at http://mailwizz.com/json-feed.php

Thanks.
 

Philip

Member
Thanks twisted1919!

The code and full example helps a lot!

Regarding my point 1 above for the frequency of sending, can I ask if I am doing it properly, or is there a setting/feature of Mailwizz that I am not utilizing?
 

twisted1919

Administrator
Staff member
Not sure about frequency, but what i can tell you is that recurring campaigns has been implemented in next version so that will make your life easier.
 

Philip

Member
Hi,
I have a new problem. I have a link in my campaign template. The code goes something like this:

[JSON_FEED_BEGIN url='[URL]http://mywebsite.com/json.php?user_id=[USER_ID][/URL]' count='5']
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td>
<div>[JSON_FEED_ITEM_TITLE]</div>
[JSON_FEED_ITEM_DESCRIPTION]<br>
[JSON_FEED_ITEM_CONTENT]</td>
<td ><a href="http://mywebsite.com/content/[JSON_FEED_ITEM_GUID]" target="_blank">blah</a></td>
</tr></tbody></table>
[JSON_FEED_END]

However, I found out from some complaints that the link as bolded above, links to the mailwizz system. Other emails seem to be linked correctly though. Do you have an idea how this can happen?
 

twisted1919

Administrator
Staff member
That can only happen if your email list gets deleted, your campaign gets deleted or the subscriber is not confirmed anymore or gets deleted. I don't see another reason.
 

Philip

Member
Recipients also complained that the unsubscribe link isn't working.

In addition, in the delivery server, I receive some replies that say "Please%20unsubscribe%20me%20from%20XXXXXXX%20list."
 
Last edited:

Philip

Member
URGENT - please help me on this:
How do I redirect users to a proper page that says that they have been unsubscribed already, if they are already unsubscribed before?
 
Last edited:

Philip

Member
That can only happen if your email list gets deleted, your campaign gets deleted or the subscriber is not confirmed anymore or gets deleted.

Lists at the most have only been renamed, campaigns are not deleted after sending out since we need the statistics, subscriber is still subscribed/exists at the point of receiving email. I have seen some of their replies to the delivery server email, when I tried to click the links in the campaign, they really link to the mailwizz system. Please help, there's complaints.. ESPECIALLY for the unsubscribe link.
 
Last edited:

Philip

Member
Also PM me the backend login to your app to be able to follow the link internally.
I am bound by contract thus unable to, as much as I'ld love to. If screenshot/on-screen recording with sensitive data covered would help, please let me know!


I did notice something funny in 1 of the url that went to a Error 404 page that says "The system is unable to find the requested action "lw8468aokpb70". I'm aware that that is the campaign's Uid. The campaign still exists.
The url goes like: http://...../lw8468aokpb70/track-url/ym050654! co468/e672a5eb450c66f7d88b7ae7e6a243d2bf8e2b31 (note the exclamation mark and space - i have no idea how it happened)


I also urgently need advice on:
How do I redirect users to a proper page that says that they have been unsubscribed already, if they are already unsubscribed before?


I have noted in an EDM where the links (taking data from json) were directed to mailwizz system - the hashes do not exist in the ebs_campaign_url table.
Firstly,
can I insert records for these hashes through phpmyadmin?
Secondly, why do these hashes not exist in the ebs_campaign_url table?
 

twisted1919

Administrator
Staff member
I did notice something funny in 1 of the url that went to a Error 404 page that says "The system is unable to find the requested action "lw8468aokpb70". I'm aware that that is the campaign's Uid. The campaign still exists.
The url goes like: http://...../lw8468aokpb70/track-url/ym050654! co468/e672a5eb450c66f7d88b7ae7e6a243d2bf8e2b31 (note the exclamation mark and space - i have no idea how it happened)
I have seen this before, it's the email client that truncates the length of the url but still not sure why.

I have noted in an EDM where the links (taking data from json) were directed to mailwizz system - the hashes do not exist in the ebs_campaign_url table.
These hashes should exist, if they don't, then that's the problem.
You can add them via phpmyadmin, but the fact taht they are not there indicates a problem.
Are you sure i can't inspect your system in any way ?
 
Top