duan0504 2017-03-07 05:56
浏览 41
已采纳

在电子邮件中显示Google地图[重复]

This question already has an answer here:

I have the following code in my email template:

<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3022.6173606180814!2d-73.98784413488774!3d40.74844444332261!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x89c259a9aeb1c6b5%3A0x35b1cfbc89a6097f!2sEmpire+State+Building%2C+350+5th+Ave%2C+New+York%2C+NY+10118!5e0!3m2!1sen!2s!4v1488865918048" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>

I used yiiMailer in order to send mails to the users, and I have the following code in my controller:

$topic='Message';
$letter = $this->renderPartial('application.views.mail.email_temp',array('model'=>$model, 'topic'=>$topic, ''),true);
$message=$letter;
$mail = new YiiMailer('contact',array('message'=>$message));
$mail->setSubject('Message');

But, when I open the sent email, it is not showing Google Maps (tested with Gmail). How can I show Google Maps in my email?

</div>
  • 写回答

1条回答 默认 最新

  • drruhc4944 2017-03-07 06:13
    关注

    You can't get JavaScript maps working in email, and Gmail won't let you embed an iframe to an email. (iFrames and JavaScript added to an email in this way would be considered a security risk.)

    What you can do, however, is embed a static map image on your email.

    1. Go to http://staticmapmaker.com/google/ and enter location wanted.

    2. Copy the generated static map image and paste it the email.

    3. Copy the href from the "Map with link to Google Maps" section.

    4. Select the image you copied/pasted into your email and do command/ctrl+k to add a link to that image.

    5. Paste the url from step #3 into Web Address field.

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

报告相同问题?

悬赏问题

  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分