作者:我的生活我做主哦耶_266 | 来源:互联网 | 2023-09-13 00:06
Ihaveaformthatallowsuserstoentertheirnames,emailadd,subjectandmessage.Whentheuser
I have a form that allows users to enter their names, email add, subject and message. When the user hits SEND, the message should be sent to me(admin). I have this code under my development config...
我有一个表单,允许用户输入他们的名字,邮件添加,主题和信息。当用户点击发送时,消息应该发送给我(admin)。我在我的开发配置下有这个代码…
config.action_mailer.delivery_method = :smtp
# SMTP settings for gmail
config.action_mailer.smtp_settings = {
:address => @user.email,
:port => 587,
:user_name => ENV['sys.questdentalusa@gmail.com'],
:password => ENV['passwordhere'],
:authentication => 'plain',
:enable_starttls_auto => true
}
and this code under my user_mailer
这个代码在我的user_mailer下。
def welcome_email(user)
@user = user
mg_client = Mailgun::Client.new ENV['api_key']
message_params = {:from => ENV[@user.email],
:to => 'sys.questdentalusa@gmail.com',
:subject => @user.subject,
:text => @user.text}
mg_client.send_message ENV['domain'], message_params
end
It won't send the message. It's as if it did not execute. The rule is, no model should be involved. Example, you have an existing gmail account and wrote a message sent to me. I should receive your message from your entered gmail account.
它不会发送消息。就好像它没有执行。规则是,没有模型应该参与。例如,您有一个现有的gmail帐户,并给我写了一条消息。我应该从你的gmail账户收到你的信息。
2 个解决方案