href link with phpmailer is erased - email

I am using phpmailer to send an email with a button that has a link to another page. For some reason it works almost everytime, except with one specific client of mine. Apperantly his email has is hotmail or outlook.
What happens in this case is that the button comes with a blanked link.
The following peace of code might help:
$mensagem .= '<br><div><!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="http://" style="height:40px;v-text-anchor:middle;width:200px;" arcsize="8%" stroke="f" fillcolor="#b1cef1">
<w:anchorlock/>
<center>[enter image description here][1]
<![endif]-->
<a href="http://conazweb.com.br/follow-up/'.$opcao1_file.'"
style="background-color:#b1cef1;border-radius:3px;color:#ffffff;display:inline-block;
font-family:sans-serif;font-size:15px;font-weight:bold;line-height:40px;text-align:center;
text-decoration:none;width:300px;margin-left: 15%; margin-right: 15%;-webkit-text-size-adjust:none;">COMPRAR VIA CONAZ</a>
<!--[if mso]>
</center>
</v:roundrect>
<![endif]--></div>';
By doing a code inspection on the button on the case that the problem is occuring I got the following code:
https://www.dropbox.com/s/dtyhtrvdk0nas5d/Inspection%20button.png?dl=0

This is ancient Microsoft VML, essentially nothing uses it any more, and support has even been dropped from Internet Explorer. If you want links to work, use plain links, which you can style to look like buttons.

Related

ColdFusion cfmail how do I keep the formatting

In my ColdFusion program I create email (HTML/CSS) for one or many recipients, and place it in a .cfm file. The email is nicely formatted. When I run the saved file as a program, the cfmail tag sends the email along to whomever, and that is all working. However, along the way, my formatting gets lost. I understand that there is no reason for my local CSS to be functioning when the email gets to its target. But it would be nice if I could preserve the formatting I started with.
Does anyone have a suggestion about how I might do this.
If you're not including the attribute type="html" in your cfmail tag, that could be affecting the formatting of your email. Also, within the cfmail tag, embed your style within in addition to your content. For example:
<cfmail from="foo#bar.com" to="foobar#bar.com" subject"test" server="mymailserver" type="html">
<html>
<head>
<style>
.test { color: ##cc0000; }
</style>
</head>
<body>
<div class="test">This email is in red</div>
</body>
</html>
</cfmail>
Styling emails can be tricky as it's different across clients - there are whole blog articles devoted to this. For example, styles in the head section get ignored in some clients and recognised in others. Sadly, inline styles seems to be the "best" approach.
There is a good overview on the campaign monitor website of what works if which clients:
https://www.campaignmonitor.com/css/
Mailchimp have a handy tool which will inline styles for you based on your HTML/CSS:
http://templates.mailchimp.com/resources/inline-css/
It's also worth including a plain text version for maximum compatibility. You can do that like this:
<cfmail to="someone#somewhere.xyz"
from="me#here.xyz"
subject="Hello!"
type="html">
<cfmailpart type="text/plain" wraptext="60">
Hello,
This is plain text version
</cfmailpart>
<cfmailpart type="text/html">
<h3>Hello</h3>
<p>This is <b style="color:red;">HTML</b> version</p>
</cfmailpart>
</cfmail>

Google DFP ads in email behaving strangely

I am trying out serving DFP ads in email. I'm following the guidelines here.
I have an ad unit set up just for email
I have a line item targeting that ad unit with just an image creative
The line item doesn't have any targeting restrictions or anything like that
The ad will show up in the email, at least the first time. The strange thing that I'm seeing is, after the first click, clicking on the ad again will often bring me to a blank page rather than the click-through page of the creative. Also, when I reopen the message, occasionally the image will not load. The code in the email looks like this:
<a href="https://pubads.g.doubleclick.net/gampad/jump?iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}&tile=1">
<img src="https://pubads.g.doubleclick.net/gampad/ad?iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}&tile=1" />
</a>
We've solved this by turning off cookies in the standard tag using the co= option; adding co=1 to the tag.
<a href="https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}&tile=1">
<img src="https://pubads.g.doubleclick.net/gampad/ad?co=1&iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}&tile=1" />
</a>
The only problem (for us) that this creates is that we're unable to serve 3rd party tags, even ones that resolve directly to .gifs, using the standard tag.
Had the same problem and I solved it by using script to redirect click via script on my web server where ad is shown again so that all the cookies can be set.
Link looks like this:
http://www.mysite.com/dfpclick.php?adunit=mailing&cbuster=1369608725
Script dfpclick.php:
<?php
/* Google DFP url redirect*/
if ($_REQUEST['adunit']) {
$sUrl = 'http://pubads.g.doubleclick.net/gampad/jump?iu=/%mygoogleid%/'.$_REQUEST['adunit'].'&sz=1x1&c='.$_REQUEST['cbuster'];
}
?>
<html>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=<?=$sUrl?>">
</head>
<body>
<?php
if ($_REQUEST['adunit']) {
echo '<img src="http://pubads.g.doubleclick.net/gampad/ad?iu=/%mygoogleid%/'.$_REQUEST['adunit'].'&sz=1x1&c='.$_REQUEST['cbuster'].'" width="0" height="0" border="0" style="width:0px; height:0px;" alt=""/>';
}
?>
</body>
</html>
It turns out that DFP for small business requires cookie support to work, even when using the non-JavaScript method of calling ads. So it works fine in web-based clients like Gmail, but it doesn't work in Outlook and the like. DFP Premium can supposedly serve ads in email without requiring cookies.
Using the co= option doesn't work for DFP Small Business. My workaround is:
Use the same code for img <img src="https://pubads.g.doubleclick.net/gampad/ad?iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster}" />
And build a redirect link on your website <a href="http://yourwebsite.com/adunit/300x250_email">. This page reads and filters the response from http://pubads.g.doubleclick.net/gampad/adx?iu=/{my_pub_id}/300x250_email&sz=300x250&c={cachebuster} in order to get the click-tracking link using javascript link=$(xmlDoc).find('a').attr('href'); and redirect.
This workaround doesn't work for rotation (more than one creative/line item is competing for the same ad unit at the same time).
I'd like to know how to serve email ads in rotation using DFP SB

Are images in HTML Mail getting replaced?

Is it possible that several mail applications (e.g. Hotmail, Thunderbird, OSx Mail) replace the whole <img> tag?
In the generated newsletter i have e.g.:
<img style="padding: 0px 10px 0px 0px; outline: none; " class="editor-img" src="/upload/11/2_5.jpg" alt="image" width="165" height="107">
and in the received newsletter i got something like:
<img src="foo" border="0">
Can someone explain me that and how i can prevent this?
Thanks
Yes this is absolutely possible. For instance T-Online in Germany exchanges images ending on .php with a dummy image. Many webmailers parse and adapt email code before it is finally rendered in the inbox. Like Gmail tel:-links numbers of which it thinks it's a phone number. In your case, the relative path doesn't make any sense. Try an absolute image path like src="http://www.YOURDOMAIN/upload/11/2_5.jpg".

How to display html button element in MS-Outlook 2010?

I have written a mailing program. The body of the mail is pure html.
All elements of the html (like a, span, p, img tags etc.) are shown in the mail output in MS Outlook 2010 except the button.
Only text (button's value) is displayed as a plain text. Even javascript event is not triggered if button has onClick event.
Note: It is working in other mailing services like gmail, yahoo. Problem is in Outlook only.
I'm not sure versions of MS Outlook 2007 onwards can handle HTML buttons, due to them using MS Words HTML processor (Which is not the best...)
As to trying to use javascript in emails - Javascript click event in outlook 2007
Ive had similar problems...
Jack.
javascript is blocked by email clients, as it is not save.
There are some solutions that more or less work in outlook:
https://litmus.com/blog/a-guide-to-bulletproof-buttons-in-email-design
Please use below mentioned HTML code this works perfectly well in outlook.
<table cellpadding="0" align="left" cellspacing="0" style="border-radius:2px; background-color:#5794FF; color:#FFFFFF">
<tbody>
<tr>
<td align="center" height="32" style="padding:0px 19px; height:32px; font-size:14px; line-height:12px">
Search Google
</td>
</tr>
</tbody>
</table>

Inserting page breaks in HTML email

I'm trying to place a page break into an HTML email using the following code but this does two things when I view the email in Outlook.
It ignores the line breaks in the 2nd table (only a problem with Outlook) and it does not page break (a problem in all non-web based email clients)!
Does anyone know how I can code this?
<table>
<tr>
<td>test<br>test<br>test</td>
</tr>
</table>
<table style="page-break-before:always;">
<tr>
<td>me<br>me<br>me</td>
</tr>
</table>
send them a document instead of HTML, or link them to a page that contains your email HTML
I think you'll end up pulling out too much hair trying to get what you're doing to work correctly, especially as newer versions of email clients come out.