Rails 3.0 发送电子邮件安全最佳实践
发送联系表格电子邮件时需要考虑哪些安全问题?
我知道在 php 中,必须小心构建电子邮件标头,因为根据注入到联系表单中的内容,他们可以使用它向使用您的电子邮件服务器的其他人发送垃圾邮件。
使用 ActionMailer 在 Rails 3.0 中发送邮件时是否需要考虑这一点?或者它能帮我处理大部分事情吗?
在编写基本的电子邮件内容(例如联系表格)时,我还应该担心其他安全问题吗?
抱歉,如果这些问题看起来很愚蠢,我从 Rails 开始,到目前为止真的很喜欢它,但有时我不确定这样的事情的最佳实践是什么。
What security concerns do I need to take into account for sending email for a contact form?
I know in php one must be careful about constructing email headers because depending on what is injected into a contact form they can use that to send spam out to other people using your email server.
Do I need to take this into account for sending mail in Rails 3.0 with ActionMailer? Or does it handle most of it for me?
Are there any other security concerns I should worry about when writing basic emailing things like contact forms?
Sorry if the questions seem silly, I'm starting out with rails and really love it so far, but sometimes I'm not sure what the best practices are for things like this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您所描述的在 PHP 中可能发生的情况在 Rails 中通常不会出现。
仅当您在邮件程序上动态设置收件人时才可能实现这一点。从 Rails 发送电子邮件时,请在 Mailer 中明确指定联系表单的收件人。如果您的电子邮件发送 html 并且您允许在表单中使用 html,请确保转义电子邮件模板中的所有输入。
The situation you've described that could happen in PHP shouldn't come up normally in Rails.
That would only be possible if you're setting the recipient on your Mailer dynamically. When sending an email from Rails, specify the recipient/s for your contact form in your Mailer explicitly. If your email is sending html and you're allowing html in your form, make sure you escape any input in the template for your email.