【问题标题】:Rails sending emails through an outside email serviceRails 通过外部电子邮件服务发送电子邮件
【发布时间】:2013-10-10 15:08:55
【问题描述】:

好的,我有一个应用程序,用户可以在其中向其他用户发送“邀请”以下载文件。我想做的是设置它,这样我就可以向用户询问他们的用户名/传递给他们的 Exchange 电子邮件帐户,然后通过他们的帐户发送邀请,而不是使用 ActionMailer。理想情况下,我希望这样在通过他们的网站发送邀请后,它也会在他们帐户中已发送的电子邮件下弹出。除了一些 ajax 调用的粗略想法之外,我有点不确定如何去做,并想看看是否有人对如何构建它有类似/好主意的经验。

提前谢谢!

【问题讨论】:

    标签: ruby-on-rails email exchange-server


    【解决方案1】:

    您仍然需要使用 ActionMailer 来发送电子邮件。但是,您将通过用户的 SMTP 服务器路由要从 ActionMailer 发送的电子邮件。

    msg = MyMailer.some_message
    msg.delivery_method.settings.merge!(@user.mail_settings)
    msg.deliver
    Where in the above mail_settings returns some hash with appropriate keys IE
    
    {:user_name=>username, :password=>password}
    

    在这篇文章中有更多关于此的信息。 How to send emails with multiple, dynamic smtp using Actionmailer/Ruby on Rails

    【讨论】:

      猜你喜欢
      • 2018-10-17
      • 1970-01-01
      • 2018-03-15
      • 2012-03-21
      • 2022-01-13
      • 1970-01-01
      • 2016-03-10
      • 1970-01-01
      • 2017-08-07
      相关资源
      最近更新 更多