1
我正在使用ruby 1.9.3p194和Rails 3.2.3。當視圖有鏈接時無法發送電子郵件
我在發送模板中有鏈接的電子郵件時遇到問題。我已經寫了下面的代碼:
invitation_mailer.rb
def event_invitation(user, event)
@user = user
@event = event
mail(:to => @user.email, :subject => "Invitation to participate in #{@event.name} event")
end
event_invitation.html.haml
Hello,
%br
%br
Your friend #{@event.user.full_name} has invited you to participate in #{@event.name} event. If you want to accept
this invitation, use the following link:
= link_to calendar_index_url, calendar_index_url
%br
%br
#{t('shared.team')}
user.rb
def xyz
...
InvitationMailer.event_invitation(self, event).deliver
end
如果我刪除鏈接線的查看,我能夠接收電子郵件,但不能與視圖內的鏈接。但日誌顯示電子郵件已發送。
LOG
Sent mail to [email protected] (6117ms)
Date: Fri, 02 Nov 2012 20:59:33 +0530
From: [email protected]
To: [email protected]
Message-ID: <[email protected]>
Subject: Invitation to participate in new event event
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Hello,
<br>
<br>
Your friend Abhimanyu Kumar has invited you to participate in new event event. If you want to accept
this invitation, use the following link:
<a href="http://localhost:3000/calendar">http://localhost:3000/calendar</a>
<br>
<br>
Dev Team
任何幫助找出問題,將不勝感激。
在此先感謝。
檢查您的垃圾郵件文件夾?發送到其他電子郵件地址? –