Plugin

Developer
Supported

EE 1
EE 2
Email-from-Template

Back to this add-on's main page
View Other Add-ons From Michael Rog

     

You must be logged in to post.

Problem using plugin to post to a Moblog when post includes an email address

Bug Report

artmem
artmem

I’m having an issue when using this plugin to post to the Moblog module when the post includes an email address. I’m also cross-posting this to the EE forum, because I’m not entirely sure that it is an issue with the plugin.

Essentially, the way the site works is the user fills out a safecracker form to create an entry in Channel A, and that form redirects to confirmation page that uses the Email fro Template plugin to send a moblog email that cross-posts some of the data from the entry to an Channel B.

Here is my moblog template:

{field name="firm-address" format="none"}{text}{/field}
{field name
="firm-city" format="none"}{text}{/field}
{field name
="firm-state" format="none"}{text}{/field}
{field name
="firm-zip-code" format="none"}{text}{/field}
{field name
="firm-phone" format="none"}{text}{/field}
{field name
="firm-email" format="none"}{text}{/field} 

Here is my email template (that runs through the Email from Template plugin—the {f1-...} fields are all EE custom text fields.):

<field:firm-address format="none">{f1-address}</field:firm-address>
<
field:firm-city format="none">{f1-city}</field:firm-city>
<
field:firm-state format="none">{f1-state}</field:firm-state>
<
field:firm-zip-code format="none">{f1-zip}</field:firm-zip-code>
<
field:firm-phone format="none">{f1-phone}</field:firm-phone>
<
field:firm-email format="none">{f1-email}</field:firm-email

And this is what a typical email sent to the moblog address looks like:

<field:firm-address format="none">Sample Address</field:firm-address>
<
field:firm-city format="none">Chicago</field:firm-city>
<
field:firm-state format="none">IL</field:firm-state>
<
field:firm-zip-code format="none">60601</field:firm-zip-code>
<
field:firm-phone format="none">123-456-7890</field:firm-phone>
<
field:firm-email format="none">name@example.com</field:firm-email

The problem occurs when the last field contains an email address. If the field is blank, everything works fine, and the moblog post works as intended. When the field contains an email address, the entire last line from the email gets posted at the end of every other field. If I view the moblog channel entry in the control panel, the entry fields all contain the correct info from the email followed by “<field:firm-email format=“none”>name@example.com</field:firm-email>”.

This error only happens with emails sent using the Email from Template plugin, but when I view the actual emails, they are formatted properly, and everything looks fine. If I copy and paste the content in to a new email and send it to the moblog module manually, it works fine. I’m not sure if if makes a difference, but I’m using gmail for the moblog email address.

Any help troubleshooting this would be greatly appreciated.

 

Michael Rog (RogEE)
# 1
Developer
Michael Rog (RogEE)

Sure, I’ll be happy to help!

First, check to make sure the “Automatically turn URLs and email addresses into links?” preference is turned off for that channel:

http://expressionengine.com/user_guide/cp/admin/channels/channel_edit_preferences.html#automatically-turn-urls-and-email-addresses-into-links

(The moblog process might be choking on the extra anchor tag…)

artmem
# 2
artmem

Thanks, Michael.

“Automatically turn URLs and email addresses into links?” is off in both channels.

Michael Rog (RogEE)
# 3
Developer
Michael Rog (RogEE)

Hmmm… okay, then. Would you feel comfortable creating some credentials for me to log into your site to check it out?

artmem
# 4
artmem

Sure. Is there a way to pm or email you the info?

Michael Rog (RogEE)
# 5
Developer
Michael Rog (RogEE)

Ah yes, sorry—michael (at) michaelrog (dot) com

artmem
# 6
artmem

Thanks. Just sent you an email.

artmem
# 7
artmem

I was wrong about the problem only happening when using the plugin. I sent a test from gmail and it caused the same problem, but then a test sent from Mac Mail worked fine. I posted the raw source of the messages on my EE support forums thread.

Michael Rog (RogEE)
# 8
Developer
Michael Rog (RogEE)

Whitespace seems to be a culprit here—Not sure why that is; Email-from-Template shouldn’t converting whitespace, nor should the template parser… I’m still stumped.

I’ll try to find a fix, and if I can make a change to the plug-in to error-proof it, I’ll push that out in the next update. Meanwhile, take out superfluous whitespace (spaces and indents) in the template/email and you’ll be good.