RSS Image Issue and Others Questions

Leandro Rocha

New Member
Hello,

I recently bought MailWizz plugin and I still learning about how to setup the things. My main objective is create a group of autosend emails to send my last x content published in my social network.

Today I created a new campaign and setup a RSS template according this article:

https://kb.mailwizz.com/articles/embed-xml-rss-feeds-into-your-campaign/

In my test mail I was able to fetch the RSS information from the RSS source, however the image is missing. This is the source code that I used:
Code:
<!DOCTYPE HTML>
<html>
<head><meta name="charset" content="utf-8"><meta http-equiv="content-type" content="text/html">
    <title>XML FEEDS</title>
</head>
<body>[XML_FEED_BEGIN url='http://www.dungeonist.com/rssfeeds/channel/feed/rss/sitepage' count='5']
<table>
    <tbody>
        <tr>
            <td><a href="[XML_FEED_ITEM_LINK]"><img alt="[XML_FEED_ITEM_IMAGE]" height="100" src="[XML_FEED_ITEM_IMAGE]" width="100" /></a></td>
            <td><strong>[XML_FEED_ITEM_TITLE]</strong>
            <p>[XML_FEED_ITEM_DESCRIPTION]</p>
            </td>
        </tr>
    </tbody>
</table>
[XML_FEED_END]<br />
<br />
[UNSUBSCRIBE_URL], [COMPANY_FULL_ADDRESS]</body>
</html>

I would like somehelp to try understand why the email is fetch everything except the image from the entries in the RSS. This is the URL of the RSS that I am testing:

http://www.dungeonist.com/rssfeeds/channel/feed/rss/sitepage

Another question that I would like to ask is if is possible to limit the quantity of RSS imported based on date. In the example the limit is based on quantity but I would like to limit to limit to all entries posted in the last 7 days.

Thanks in Advanced
 
Last edited:
@Leandro Rocha - Mwz is looking for a <image/> tab inside the rss feed, and your above feed does not have such tag that's the reason.
if instead of:
Code:
<enclosure type="image/png" length="317956" url="http://www.dungeonist.com/public/sitepage_page/73/1d/1d56_235f.png?c=cb15"/>
You'd have:
Code:
<image>http://www.dungeonist.com/public/sitepage_page/73/1d/1d56_235f.png?c=cb15</image>
Then it should work.
 
Hi twisted1919,

Thanks for your reply. Let me ask you a last thing. Is possible to limit the RSS fetched base on date instead quantity? I would like to limite the quantity based in the posts published in the last X days instead of a fixed quantity.

Thanks
 
@Leandro Rocha - Unfortunately mailwizz cannot do anything else related to feeds, it's just a super simple implementation right now.
What you could do is to generate a custom feed and make mailwizz fetch that.
 
@twisted1919

I was reading last night about the RSS 2.0 specification and I think that maybe we have a problem if what you said above is correct.

Mwz is looking for a <image/> tab inside the rss feed, and your above feed does not have such tag that's the reason.
if instead of:

According the w3c validator the image tag is a element from channels, so I can have only one in the whole RSS. Take a look:

RSS 2.0 specification.png

While the tag enclosure if for items and can be declared several times.

RSS 2.0 specification enclosure.png

So if MailWizz is looking for <image> tag inside a RSS feed it will grab a unique image for all items, since <image> tag is associated with channels and not items, is this correct? I am planning a custom work to allow me use the enclosure tag, but I would like to confirm if this is the way that MailWizz work.

Mailchimp and CampaignMonitor, by example, work with <enclosure.> tag, so I am confused if the MailWizz can fetch only one image for all items (what is a bit weird) or I need to use a non-valid RSS. Considering that the information from w3c is correct fetch a <image> channel for a item only make sense to me if a item dont have a own declared image in the <enclosure> tag.

This is the article from W3C: https://validator.w3.org/feed/docs/rss2.html
 
@twisted1919 can you confirm if my point above is correct? I am in doubt about the MailWizz work with image after this, if the system fetch only one image for all items or if I need a RSS that is not compliance with RSS 2.0?
 
@Leandro Rocha - The image tag can reside inside item. so each item can have it's own.
However, i just took a look in the code and at some point the code does this:
PHP:
if (empty($itemMap['image']) && !empty($item->enclosure) && !empty($item->enclosure->url) && !empty($item->enclosure->type) && strpos((string)$item->enclosure->type, 'image/') !== false ) {
    $itemMap['image'] = (string)$item->enclosure->url;
}
So it seems that we also support the enclosure element, so i tried your feed and indeed i could not see the images.
I then rewrote the above portion of the code in:
PHP:
if (empty($itemMap['image']) && isset($item->enclosure)) {
    $enclosure = $item->enclosure;
    $url  = isset($enclosure->attributes()->url) ? (string)$enclosure->attributes()->url : null;
    $type = isset($enclosure->attributes()->type) ? (string)$enclosure->attributes()->type : null;
    if (!empty($url) && strpos($type, 'image/') === 0) {
        $itemMap['image'] = $url;    
    }
}
And voila:
Screenshot 2016-11-10 10.28.33.png

I attached the modified file, put it in apps/common/components/utils/ folder to override existing one(unzip first).
Thanks.
 

Attachments

  • CampaignXmlFeedParser.php.zip
    2.2 KB · Views: 18
Thanks for your help @twisted1919!

Any possibility in a future update we have some new feature to RSS Mails like "multiple RSS per campaign" or restrict items fetched not only in number but in time also?
 
You can already do this ;)

Yeah! Now I noticed my mistake, there was a missing tag. Thanks again.

This has to be added.

Please let me know if is possible to add this feature in a future release. I would love that script to have this kind of feature because it would allow me to create automatic campaigns without running the risk of sending content repeated from one week to the next. I asked by a custom work to add this feature, but seems that the unique interested abandoned the idea.
 
Hi !
I'm having problem with images. They are not included in newsletter. Everything else works perfect.

Here is my RSS template:

<!DOCTYPE HTML>
<html>
<head><meta http-equiv="content-type" content="text/html" />
<title>XML FEEDS</title>
</head>
<body>[XML_FEED_BEGIN url='[URL]https://ofertaime.al/feed/?post_type=ad_post[/URL]' count='5' offset='0']
<table>
<tbody>
<tr>
<td><a href="[XML_FEED_ITEM_LINK]"><img height="100" src="XML_FEED_ITEM_IMAGE" width="100" /> </a></td>
<td><strong>[XML_FEED_ITEM_TITLE]</strong>
<p>[XML_FEED_ITEM_DESCRIPTION]</p>
</td>
</tr>
</tbody>
</table>
[XML_FEED_END] [DIRECT_UNSUBSCRIBE_URL]</body>
</html>


And here is a part of my website RSS output:
<item>
<title>Irisoft Education ju mirëpret</title>
<link>https://ofertaime.al/shes-blej/irisoft-education-ju-mirepret/</link>
<pubDate>Tue, 10 Sep 2019 20:01:55 +0000</pubDate>
<dc:creator><![CDATA[Irisoft Education]]></dc:creator>

<guid isPermaLink="false">https://ofertaime.al/shes-blej/irisoft-education-ju-mirepret/</guid>
<description><![CDATA[Ne jemi një nga qendrat e para didaktike ne Shqipëri Aktiviteti ynë bazohet në trainime në fushën e kompjuterit për një gamë mjaft të gjerë programesh kompjuterike, në të gjitha gjuhët e huaja të kërkuara nga tregu vendas si dhe gjuhën shqipe për të huajt. Gjithashtu qendra ka zgjeruar gamën e shërbimeve të saj me [&#8230;]]]></description>
<image>"https://ofertaime.al/wp-content/uploads/2019/09/image2-1-300x162.jpg" width="300" height="162" </imag> </item>

Any suggestion, please.
 
Looking at https://ofertaime.al/feed/?post_type=ad_post i can see your image tags look like:
Code:
<image>"https://ofertaime.al/wp-content/uploads/2019/09/multicooke2r-300x225.jpg" width="300" height="225" </image>
Which makes no sense, they are not correct, this is why mailwizz cannot parse that.
This is the correct way:
Code:
<image>https://ofertaime.al/wp-content/uploads/2019/09/multicooke2r-300x225.jpg</image>
or
Code:
<enclosure url="https://ofertaime.al/wp-content/uploads/2019/09/multicooke2r-300x225.jpg" type="image/jpeg"/>
Latter one would work more than sure since we adjusted our code after the above example a while back.
 
Back
Top