我正在使用导轨 3.2.8。
按照http://www.railsmine.net/2010/03/rails-3-action-mailer-example.html上的教程
但似乎效果不佳。
似乎无法识别嵌入在 ruby 代码中的 javascript
我认为导致问题的代码
def support_notification(sender)
@sender = sender
mail(mail(:to => "administrator@yourdomain.com <script type="text/javascript">
/* <![CDATA[ */
(function(){try{var
s,a,i,j,r,c,l=document.getElementById("__cf_email__");a=l.className;if(a)
{s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2)
{c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}
s=document.createTextNode(s);l.parentNode.replaceChild(s,l);}}catch(e){}})();/* ]]> */
</script>",
:from => sender.email,
:subject => "New #{sender.support_type}")
end
错误提示
app/mailers/notifier.rb:6: syntax error, unexpected tIDENTIFIER, expecting ')'
...ourdomain.com<script type="text/javascript">
... ^
app/mailers/notifier.rb:6: syntax error, unexpected tSTRING_BEG, expecting keyword_do or
'{' or '('...m<script type="text/javascript">
... ^
app/mailers/notifier.rb:8: syntax error, unexpected tIDENTIFIER, expecting keyword_end
...nt.getElementById("__cf_email__");a=l.className;if(a){s='';r...
... ^
app/mailers/notifier.rb:12: syntax error, unexpected ')', expecting keyword_end