douye7033 2015-09-11 14:48
浏览 228
已采纳

如何使用在线托管的html电子邮件签名?

for my email signature I want to use a hosted HTML code that is generated through a PHP script, since I may want to change information of the signature I really want that hosted solution to be sure that not only mails in the future, but also sent mails have the "new" signature.

I have a PHP script behind "tld.com/signature/my@mail.com" (yes, no .php ending) waiting for a call. If i open that domain it will output valid HTML code.

But how can I embed the output in my mails as html signature? Iframes are not an option, since they dont work everywhere. Html img tags dont work since that url doesnt output an image.

Any ideas? :-) - Thanks!

  • 写回答

1条回答 默认 最新

  • doubo82706 2015-09-11 15:21
    关注

    As far as I can see image and iframe are the only way of achieving this, though you could possibly use dynamic css too; either way, your signature generation API would need to change, or at least be wrapped.

    A blog post here details how the author went about doing just this for posting dynamic scores on a user's Facebook wall.

    This is the workflow they used:

    PHP HTML -> Image

    As the score had to be dynamic, what they did was create an API to take a snapshot image of the HTML content which the client could then show.

    They created an API endpoint which would

    1. Query the score HTML generator endpoint (in your case signature generation) to generate the HTML you want the client to display.

    2. Turn the HTML into PDF using the HTML2PDF utility for PHP 5.2.

    3. Render the PDF into an image which can then be returned to the user for displaying using PHP::ImageMagick.

    They did this with the following code:

    $html2pdf = new HTML2PDF('P', 'A4');
    $html2pdf->writeHTML($html_content);
    $file = $html2pdf->Output('temp.pdf','F');
    
    $im = new imagick('temp.pdf');
    $im->setImageFormat( "jpg" );
    $img_name = time().'.jpg';
    $im->setSize(800,600);
    $im->writeImage($img_name);
    $im->clear();
    $im->destroy();
    

    The image returned by this API can then be rendered into an image tag for display to the client. There is a demo of this workflow in action available here.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!