I have been having this problem for a while now, so decided to have a look at the PHP code and have something that works, but needs improving.
In the “filter_CleanHtml” function of postie-filters.php, I have modified some of the code as shown below, so that it looks for “a” tags and then modifies the outertext accordingly and adds “embed” around the link. I could not get it to work any other way.
I am using Outlook 365 as my email client.
I had set “plain text” emails to get the links to embed properly, but any link that was over 75 or 80 characters would then end up getting broken in my post (a common problem for me). This (below) converts Youtube and MP3 links to embeds. Perhaps this can be added in the next update – and improved slightly to draw on WordPress’s current list of embeddable types of links/things (Dailymotion etc)
foreach ($html->find('script, style, head,a') as $node) {
//DebugEcho("filter_CleanHtml: Removing: " . $node->tagname . "=" .$node->nodename . "=" . $node->nodetype . "=" . $node->nodevalue . "=" . $node->innertext);
if(isset($node->href))
{
if (strstr($node->innertext, "youtube.com") || (strstr($node->innertext, ".mp3")))
{
DebugEcho("filter_CleanHtml: Setting Link so that it will embed.");
$node->outertext="[embed]" . $node->innertext . "[/embed]";
}
}
else
{
DebugEcho("filter_CleanHtml: Removing: " . $node->innertext);
$node->outertext = '';
}