Rails 和 Gmail SMTP,如何使用自定义发件人地址 [英] Rails and Gmail SMTP, how to use a custom from address

查看:55
本文介绍了Rails 和 Gmail SMTP,如何使用自定义发件人地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将 Rails (2.1) 应用程序设置为通过 Gmail 发送电子邮件,但是每当我发送电子邮件时,无论我在 ActionMailer 中将发件人地址设置为什么,电子邮件总是像从我的 Gmail 电子邮件地址发送一样.这是他们在 Gmail 中设置的安全限制,以阻止垃圾邮件发送者使用他们的 SMTP?

I've got my Rails (2.1) app setup to send email via Gmail, however whenever I send an email no matter what I set the from address to in my ActionMailer the emails always come as if sent from my Gmail email address. Is this a security restriction they've put in place at Gmail to stop spammers using their SMTP?

注意:我在 ActionMailer 中尝试了以下两种方法(以防万一):

Note: I've tried both of the following methods within my ActionMailer (just in case):

@from = me@mydomain.com
from 'me@mydomain.com'

推荐答案

我相信这只是 Gmail 在通过其 SMTP 发送邮件时所做的事情,正如在关于使用 SMTP 发送邮件的教程中提到的那样.

I believe it's just something Gmail does when mail is sent through its SMTP, as it was mentioned that they do this on a tutorial about using their SMTP to send mail.

这篇关于Rails 和 Gmail SMTP,如何使用自定义发件人地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆