Rails通过外部电子邮件服务发送电子邮件

好吧,我有一个应用程序,用户可以向其他用户发送“邀请”以下载文件。我想要做的是设置它,以便不使用ActionMailer,我可以要求用户将他们的用户名/密码传递到他们的Exchange电子邮件帐户,然后通过他们的帐户发送邀请。理想情况下,我希望在通过他们的网站发送邀请后,它也会在其帐户中发送的电子邮件下弹出。除了对一些Ajax调用的粗略想法之外,我还有点不确定如何去解决这个问题,并想知道是否有人对如何构造这个类似/好的想法有任何经验。Rails通过外部电子邮件服务发送电子邮件

提前致谢!

回答:

您仍然需要使用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

以上是 Rails通过外部电子邮件服务发送电子邮件 的全部内容, 来源链接: utcz.com/qa/258938.html

回到顶部