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.

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

报告相同问题?

悬赏问题

  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行