gpt4 book ai didi

ruby-on-rails-3 - 继续获取发送消息所需的发件人(返回路径、发件人或发件人)

转载 作者:行者123 更新时间:2023-12-04 15:36:05 24 4
gpt4 key购买 nike

class SupportMailer < ActionMailer::Base
default :from => "email1@gmail.com"

def welcome_email(ticket)
case ticket.game
when "gameone"
@ticket = ticket
headers["Reply-to"] = "email1+#{ticket.token}@gmail.com"
headers["Return-Path"] = "email1+#{ticket.token}@gmail.com"
mail(:from => "email1@gmail.com", :to => ticket.email, :subject => "Welcome to 1 Support Ticket")
when "gametwo"
@ticket = ticket
headers["Reply-to"] = "email2+#{ticket.token}@gmail.com"
headers["Return-Path"] = "email2+#{ticket.token}@gmail.com"
mail(:from => "email2@gmail.com", :to => ticket.email, :subject => "Welcome to 2 Support Ticket")
when "gamethree"
@ticket = ticket
headers["Reply-to"] = "email3+#{ticket.token}@gmail.com"
header["Return-Path"] = "email3+#{ticket.token}@gmail.com"
mail(:from => "email3@gmail.com", :to => ticket.email, :subject => "Welcome to 3 Support Ticket")
end
end
end

我已经设置了我的默认值:from,所以我不明白为什么我一直收到这条消息,我也试图通过标题设置它无济于事。

这是我的设置
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:user_name => "emailx@gmail.com",
:password => "password",
:authentication => "plain",
:enable_starttls_auto => true
}

我只是这样称呼它, SupportMailer.support_response(@message).deliver
我该如何解决?

最佳答案

我注意到您的 case 语句没有默认情况。如果您最终从未在 Mailer 类的方法中调用“mail”方法,您将收到该错误。尝试将您的案例陈述移到您调用 SupportMailer 的地方,也许每个案例都有方法。这样您就永远不会调用 SupportMailer,除非您已经确定了正确的票务游戏。

关于ruby-on-rails-3 - 继续获取发送消息所需的发件人(返回路径、发件人或发件人),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9690356/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com