Pergunta

I am using Rails Action Mailers to send mails. I am successfully able to send emails to individual id's. I want to send email to a google group so that it mails all the people subscribed to that group. If I just email the group using my gmail account, all subscribers get the email but not through Action Mailer. Console output looks like it did send but unfortunately subscribers are not getting it.

 #<Mail::Message:70252634244300, Multipart: false, Headers: <Date: Fri, 12 Jul 2013 14:02:04 -0500>, <From: test@gmail.com>, <To: <google-group>@gmail.com>, <Message-ID: <51e052ac70b3f_a2df3fe4f5c35ae0536c4@GM15973.group.on.mail>>, <Subject: Welcome!>, <Mime-Version: 1.0>, <Content-Type: text/html>, <Content-Transfer-Encoding: quoted-printable>>

Mailer

class BlahMailer < ActionMailer::Base
  default from: "test@gmail.com"

  def welcome_email
    @mail = "google-group@gmail.com"
    @tweets = Twitter.user_timeline("tweettest").first.text
    mail(to: @mail, subject: 'Welcome!')
  end

If I replace google-group@gmail.com with an indvidual's id, it works fine.

Foi útil?

Solução

Figured it out. The google group belongs to the organization whereas I was trying to send email from a regular gmail account. Changed the group settings to allow external accounts to post to it and it worked.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top