我正在尝试发送一封包含Rails 3和Action Mailer的电子邮件.电子邮件很好,但我希望它是HTML格式的一些基本样式,包括背景图像.我知道图像可能会被阻止,直到用户允许它们显示,但我仍然认为最好链接到我的Web服务器上的图像.
名为registration_confirmation.html.erb的电子邮件模板如下所示:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
body {
background: url(/images/mainbg_repeat.jpg) top repeat-x #cfcfcf;
margin: 0px 0px 0px 0px;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #565656;
}
Run Code Online (Sandbox Code Playgroud)
获取背景图像的url链接以包含完整主机以使背景显示在电子邮件中的最佳方法是什么?
我有一个使用Onsen UI的简单应用程序,我正在利用轮播并根据用户是向左还是向右滑动到当前轮播元素来更新数据.一旦他们刷过,我想从旋转木马中移除该元素,以便他们无法再次使用它.我试图使用postchange事件似乎工作正常,但当我调用carousel.refresh()时,旋转木马不会更新.
旋转木马在html中定义如下:
<ons-carousel var="carousel" swipeable overscrollable auto-scroll fullscreen initial-index="1">
<ons-carousel-item ng-repeat="foo in bar.baz">
....
</ons-carousel-item>
</ons-carousel>
Run Code Online (Sandbox Code Playgroud)
因为轮播在第一页以外的页面上初始化,所以我添加了一个事件处理程序来监视推送到导航控制器上的新页面,如果它是带有轮播的页面,则初始化一个处理程序旋转木马的postchange事件并更新一些东西.我已经简化了这个例子的情况.
ons.ready(function(){
mainNavigator.on('postpush', function(event){
var page = event.enterPage;
if (page.name == "carousel_page.html"){
carousel.on('postchange', function(event){
$scope.bar.baz.splice(event.lastActiveIndex, 1);
setImmediate(function(){
// even setting the array to [] here does not make a difference
carousel.refresh();
});
});
}
});
});
Run Code Online (Sandbox Code Playgroud)
单步执行我可以验证轮播后面的数组是否正确更新并且carousel变量定义正确,并且刷新()被调用,但我的轮播永远不会更新.我在这里错过了什么?
我正在使用Angular和Onsen,这是因为我正在添加事件处理程序的方式吗?它是在$ digest周期之外还是什么?
我一直在尝试找出如何将收件人自动添加到通过其Ruby库使用Gmail API创建的草稿电子邮件中。我可以毫无问题地创建草稿,但设置收件人会给我造成麻烦,而且我还找不到任何显示添加电子邮件特定内容的最佳方法的良好示例。
使用Google API操场并拉入已经创建的草稿,看起来结构应类似于下面所示,但是一旦创建草稿,便没有收件人。
@result = client.execute(
:api_method => gmail.users.drafts.create,
:parameters => {
'userId' => "me"
},
:body_object => {
'message' => {
'raw' => Base64.urlsafe_encode64('Test Email Message'),
'payload' => {
'headers' =>
[
{
'name' => "To",
'value' => "John Smith <john_smith.fake@gmail.com>"
}
]
}
}
}
)
Run Code Online (Sandbox Code Playgroud) actionmailer ×1
angularjs ×1
cordova ×1
gmail ×1
gmail-api ×1
google-api ×1
html-email ×1
onsen-ui ×1
ruby ×1