Method Community

 

SendEmailV2 with email templates

Last post 07-05-2012 3:50 PM by Matt. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 07-05-2012 1:50 PM

    • Matt
    • Top 10 Contributor
    • Joined on 11-04-2008
    • Posts 877

    SendEmailV2 with email templates

    I am trying to duplicate the ability to send an email using an email template from the API instead of from within Method.

    I used Select_DataSetV2 to retrieve the email body from the template I wanted to use and then put the returned data in the email body field when calling the SendEmailV2. When I receive the email the body just shows all the html code instead of a formatted body like I was hoping. An suggestions on how to get it to display correctly using the API to send the email?


    Matt Raiser

    Founder,



    www.techinthefield.com

    matt@techinthefield.com

    219-221-9500



    ~ Method user / partner since 2008

    ~ Over 15 years field service experience

    ~ 2013 Method Partner of the Year

    ~ Degree in Computer Science





    Creator of:


        


  • 07-05-2012 2:40 PM In reply to

    Re: SendEmailV2 with email templates

     Hi Matt,

    Are the html tags encoded? That would cause them to show up as html code rather than as a formatted body

    Dave

  • 07-05-2012 2:43 PM In reply to

    • Matt
    • Top 10 Contributor
    • Joined on 11-04-2008
    • Posts 877

    Re: SendEmailV2 with email templates

    Hi Dave,

    How would you include formatted text in the SendEmailV2 email body field?


    Matt Raiser

    Founder,



    www.techinthefield.com

    matt@techinthefield.com

    219-221-9500



    ~ Method user / partner since 2008

    ~ Over 15 years field service experience

    ~ 2013 Method Partner of the Year

    ~ Degree in Computer Science





    Creator of:


        


  • 07-05-2012 2:57 PM In reply to

    Re: SendEmailV2 with email templates

     Hi Matt,

    I would just put the html in there without encoding the tags

    e.g.<strong>Something bold.</strong>

    Dave

  • 07-05-2012 2:59 PM In reply to

    Re: SendEmailV2 with email templates

     Sorry Matt,

    My last response got submitted while WIP anyway...

    I would just put the html in there without encoding the tags

    e.g.<strong>Something bold.</strong>

    would show up as

    Something bold

    Dave

  • 07-05-2012 3:12 PM In reply to

    • Matt
    • Top 10 Contributor
    • Joined on 11-04-2008
    • Posts 877

    Re: SendEmailV2 with email templates

    Dave,

    Ok I was successful in sending an email without the encoding...

    next question is: how do I retrieve the email body field from the EmailTemplate table without the coding to be able to send it automatically?


    Matt Raiser

    Founder,



    www.techinthefield.com

    matt@techinthefield.com

    219-221-9500



    ~ Method user / partner since 2008

    ~ Over 15 years field service experience

    ~ 2013 Method Partner of the Year

    ~ Degree in Computer Science





    Creator of:


        


  • 07-05-2012 3:39 PM In reply to

    Re: SendEmailV2 with email templates

    Answer

      Hi Matt,

    The dataset should not be returning encoded data, unless it is encoded in the table in your method account.

    If the data is encoded you should be able to decode it with a simple .NET HttpUtility.HtmlDecode

    e.g HttpUtility.HtmlDecode("&lt;strong&gt;Something Bold.&lt;/strong&gt;") will return <strong>Something Bold.</strong>

    Dave

  • 07-05-2012 3:50 PM In reply to

    • Matt
    • Top 10 Contributor
    • Joined on 11-04-2008
    • Posts 877

    Re: SendEmailV2 with email templates

    Hi Dave,

    The dataset was returning encoded data, and I was using one of the stock email templates to test it out.

    The HttpUtility.HtmlDecode did the trick though and now it is working beautifully, thanks for your help!


    Matt Raiser

    Founder,



    www.techinthefield.com

    matt@techinthefield.com

    219-221-9500



    ~ Method user / partner since 2008

    ~ Over 15 years field service experience

    ~ 2013 Method Partner of the Year

    ~ Degree in Computer Science





    Creator of:


        


Page 1 of 1 (8 items)