Jump to content

EmailSetBody and Sending HTML


This topic is 3307 days old. Please don't post here. Open a new topic instead.

Recommended Posts

This should be real easy and I can't figure out what I'm doing wrong.  I want to send HTML email and every time I send it, i just get the raw html in the message.  

 

So here is what I am doing.  I first set the HTML equal to a variable $HTML

 

Set Variable [ $HTML; Value:"<!doctype html>

<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
</head>
 
<body>
<div align="left"><img src="%5C'>"width="747" height="163" alt=""/>
</div>
<p align="left"><strong>DRAFT DRAFT DRAFT --- Texas Rail Advocates News Update</strong></p>
- - - - - - - - - - - - -<br>
<p>Greetings TRA Members and Friends.  A lot is happening in the rail world right now and this is our monthly newsletter with the latest information updates.</p>
<p>Due to an unusual snow storm in Dallas this past Wednesday, March 4th, our TRA Board Meeting was canceled because our meeting facility closed down.  A few of you showed up and our apologies that it was not open and we could not meet.  The Board Meeting has been rescheduled to March 11th at the Center for Nonprofit Management, 2900 Live Oak St., Dallas, Texas, 75204, 6:30 PM. This meeting will include the annual election of the President.  </p>
<p>U.S. House passes Amtrak funding bill. We have the vote tally by Congressional district in Texas. More Representatives voted No than voted Yes.</p>
<p>One Texas lawmaker wants to stop high speed rail in its tracks with a House bill filed in the legislature. </p>
<p>One Texas county judge has formed an anti-bullet train lobbying group</p>
<p>Heartland Flyer train between Fort Worth and Oklahoma City faces funding shortfall. </p>
<p>Union Pacific announces Phase 2 of railroad work San Antonio to Houston. </p>
<p>In our opinion: Consequences for opposing high-speed rail in Texas are many. </p>
<p>Keep up to date with freight and passenger rail news. Check back frequently to <a href="http://www.TexasRailAdvocates.org">www.TexasRailAdvocates.org</a></p>
<p>- - - - - - </p>
<p>&nbsp;</p>
<p></p>
</body>
</html>
" ]
 
 
Then I run the script with this script step in it:
 
Set Variable [$Result; Value:EmailConnectSMTP( "SomeSmtpURL.com" ; "UserName" ; "Password" ; "tls=true" ) and 
EmailCreate( "[email protected]" ; "[email protected]" ; "Some Subject" ) and
EmailSetBody( GetAsCSS( $HTML ); "html" ) and
EmailSend and
EmailDisconnect]
 
I've tried changing the EmailSetBody by removing the GetAsCSS or having it point to a field instead of a variable, but it never works.  It always sends it as plain text email showing up with the raw html in the message.  It looks like I have specified the "html" parameter properly.  What do you think I have done wrong?
 
Thanks for any assistance.
 
TAYLOR SHARPE
 
 
PS:  Doing this on a Mac running Mac OS X 10.10.2 with FMPA 13.0v5 and Email Plugin 2.11
Link to comment
Share on other sites

GetAsCSS should only be used when you're wanting to get formatted FileMaker text out of a text field. In a situation like this, where you're manually writing the HTML, you should just run "EmailSetBody($HTML ; "html" )" .  If that doesn't work, could you attach the raw source of the email your received from our plugin? You can view the raw source in Apple Mail using the View/Message/Raw Source... menu command, or in our plugin using EmailReadMessageValue("raw"). There should be similar features in any other mail client.

  • Like 1
Link to comment
Share on other sites

Thanks Evan.... that makes sense.  I took out the GetAsCSS and it works great.  I now see how that works.  If you had some text in a field formatted with RTF (bold, color, etc.), then that would make it convert to HTML code.  But since I am already writing that code, then it doesn't need the GetAsCSS.  

 

Much appreciated.  You've helped me twice.  Maybe I'll get to meet you at Devcon 2014.  Hope so.  Cheers!

Link to comment
Share on other sites

That's right, Taylor; we recommend using GetAsCSS on formatted text fields as a simple way to achieve formatted emails without needing to manually write HTML. For more advanced users like yourself, manually writing the HTML is of course much more powerful. 

 

Looking forward to seeing you at DevCon!

Link to comment
Share on other sites

This topic is 3307 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.