本来想做一个用户可以通过他们的邮箱发送邮件到我的邮箱,但不知道为什么每次工作都变成我自己的邮箱发送到我自己的邮箱,发件人和收件人都是我自己,有人介意给我一些帮助吗。。。这是我的代码 post '/contact_form' do · @submitted = true
@user_email = params[:user_email].strip @message = params[:message].strip address_to_send_to = h params[:user_email] message_to_send_to = h params[:message] @user_email_ok = !@user_email.nil? && @user_email !="" @message_ok = [email protected]? && @message != "" @all_ok = @user_email_ok && @message_ok
@page='contact_form'
options = { :address => "smtp.gmail.com",
Mail.defaults do delivery_method :smtp, options end
Mail.deliver do to '[email protected]' from address_to_send_to subject 'user_feedback' body (address_to_send_to + ":" + message_to_send_to) end erb :contact end