Viewing 5 replies - 1 through 5 (of 5 total)
  • I also needed this and found the following in the help tab (drop down at top of Email Encoder Bundle admin page):

    Encode the given email (other params are optional):
    <?php echo encode_email($email, [$display], [$method], [$extra_attrs]); ?>

    Encode the given content for emails to encode (other param is optional):
    <?php echo encode_content($content, [$method]); ?>

    If you are spitting out a custom field in a template, one of the above two methods should work to encode the email.

    Pi Zi

    (@freelancephp)

    Exactly, this can be solved by using the template function.
    I will add it to the FAQ.

    Thanks Lariza and Bridget!

    Hello, i switched to your plugin recently also because I’ve think this thread would definitively fix my problem but I did not get it working in a specific case, i haver the following code in my template and would like to encode the email address, i can get it working when i call the encoding in plain text

    Send a email to <strong><?php $emailforrequest = get_post_meta($post->ID, 'emailforrequest', TRUE);
    echo eeb_email($emailforrequest, 'the support team'); ?></strong> to get help.

    this is ok ! But if i try to insert it in my “mailto” template as the following example it does not works.

    <a title=click here to open the email" href="mailto:<?php the_field('emailforrequest'); ?>?subject=the subject line&Body=my body content that may call other php function such as <?php the_title(); ?>"><img class="imgclass" title="imgtitle" alt="imgalt" src="imgsource.png" width="240" height="24" /></a>

    at this point i replaced

    <?php the_field('emailforrequest'); ?>

    with

    <?php $emailforrequest = get_post_meta($post->ID, 'emailforrequest', TRUE);
    echo eeb_email($emailforrequest, 'Mail Me'); ?>

    but it does not works at all.

    I’ve followed your FAQ and tips but cannot get it working, also i did not found the way to generate a mailto template to with PHP, it may works better as i could call each element (email, subject and body) with single PHP string and avoid to broke the encoding function.

    Many thanks for your help

    Pi Zi

    (@freelancephp)

    You have to encode the whole mailto link. This should work:

    $mailto = '<a title="click here to open the email" href="mailto:' . get_field('emailforrequest') . '?subject=the subject line&Body=my body content that may call other php function such as ' . get_the_title() . '"><img class="imgclass" title="imgtitle" alt="imgalt" src="imgsource.png" width="240" height="24" /></a>';
    
    echo eeb_email_filter($mailto);

    Nice! It seems to work well and fit my -encoding- needs!

    I still have a problem with the ‘ sign used in the Email template that broke the php code (you know those ” and ‘ around) but i will find the way to get it working.

    My last question would be: a bot or spambot could get or use this mailto linked image to spam around?

    Actually my mailto image is hidden in a DIV that user have to unhide by clicking a #link, but i would like to avoid this user action by having the mailto image available to users as soon they land on my page (visitors only and not bot, of course).

    Many thanks for your support and for this plugin that really works.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Doesn't work in custom fields?’ is closed to new replies.