Tag: email

在Rails中将外部CSS转换为邮件的内联CSS

我正在尝试创建一个应用程序,它将发送风格繁重的电子邮件,并要求客户工作,除了谷歌的Gmail。 我研究了这个问题,看起来Gmail从外部文件或嵌套在’style’标签中的CSS中删除了CSS。 是否存在将样式从外部文件移动到内联的简单方法? 需要的东西: .wide { width: 100px; } .cell { display: block; } Sample 并将其转换为: Sample 谢谢!

为什么autoload无法加载gem文件

我正在尝试使用这个gmail gem阅读ruby中的电子邮件。 当我在IRB或脚本中require ‘gmail’时,我收到此错误: /Library/Ruby/Gems/1.8/gems/gmail-0.4.0/lib/gmail.rb:70:in connect_with_proper_client’: no such file to load — gmail/client (LoadError) from /Library/Ruby/Gems/1.8/gems/gmail-0.4.0/lib/gmail.rb:48:in new 发生这种情况是因为自动加载无法提交“gmail / client”文件。 当我手动添加require ‘gmail/client’ ,问题就会消失,直到下一次自动加载呼叫。 这个解决方案是不可接受的,因为我无法预测要提前添加哪些文件。 我发现了一个类似的问题 ,但它没有解决我的问题。

如何使用Ruby处理UTF-8电子邮件标题(如Subject :)?

我是一封电子邮件n00b,但我正在开发一个发送带有Unicode字符的HTML电子邮件的应用程序(正如我的朋友所说“享受编码地狱”)。 Subject:标题来自用户输入,因此可能包含Unicode字符。 一些邮件客户端(如GMail和Outlook 2007)可以正常使用,但从我的阅读中看来,正确的方法是对标头使用MIME编码字编码 。 我找不到一个Ruby库来做这件事。 有吗? 此外,是否有一个标题要添加,告诉邮件客户端在显示邮件时使用UTF-8? 我们发送多部分电子邮件,因此我们的Content-Type是multipart/mixed 。 Apple Mail.app特别没有使用正确的编码,即使它在各个部分中指定为UTF-8。

rails email error – 530-5.5.1需要validation。

尝试从Ruby on Rails发送电子邮件,但得到这个: SocketError in UsersController#create getaddrinfo: nodename nor servname provided, or not known 我的environment / development.rb文件有: config.action_mailer.smtp_settings = { address: “smtp.gmail.com”, port: 587, domain: “my_company.org”, authentication: “plain”, enable_starttls_auto: true, user_name: “my_username@my_company.org”, password: “my_pass” } 和 config.action_mailer.delivery_method = :smtp 和 config.action_mailer.default_url_options = { :host => ‘localhost:5000’ } # 5000 rather than 3000 as I am […]

Rails 3.2`link_to`(在电子邮件中)与`method :: put`仍然产生GET请求

在我的应用程序中,我有自动电子邮件提醒应用程序完成面试过程的下一步。 电子邮件有一个选择退出链接,单击该链接时,应该触发一个控制器操作,该操作将触发状态机事件以将其状态更改为opted_out 。 链接不起作用,并且从localhost控制台看起来似乎是因为链接仍然产生GET请求,没有路由(错误是ActionController::RoutingError (Not Found): 。 这是显示不需要的GET请求的控制台: Started GET “/worker/application/opt_out.1” for 10.0.2.2 at 2014-08-29 17:08:06 +0000 Processing by LandingController#show as Parameters: {“category”=>”worker/application”, “location”=>”opt_out”} 链接在这里: link_to ‘stop getting these reminders’, opt_out_worker_application_url(@worker), method: :put, style: ‘background-color: #fff; color: #56A0D3; display: inline-block; margin-bottom: 5px; margin: 0px; padding: 0px; text-decoration: none’ 以下是worker命名空间的所有路由: # routes.rb namespace :worker do resource […]

尝试在RoR应用程序中发送电子邮件时遇到SMTP错误

我一直在拼命尝试使用RoR中的Action Mailer类发送电子邮件,即使终端显示正在发送消息,它仍然会返回此错误: et::SMTPAuthenticationError: 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbtOS from /Users/abhasarya/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/smtp.rb:968:in `check_auth_response' from /Users/abhasarya/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/smtp.rb:739:in `auth_plain' from /Users/abhasarya/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/net/smtp.rb:731:in `authenticate'… 这是我的邮件程序类在app / mailers / my_mailer.rb中的样子: class MyMailer < ActionMailer::Base default from: "from@example.com" def welcome_email(user) @user = user mail(to: user.email, from: 'example_email@gmail.com', subject: 'Welcome!') end end 这是我的config / application.rb文件的样子: config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { address: ‘smtp.gmail.com’, port: 587, #domain: ‘gmail.com’, user_name: […]