To start out I''ll say that this is the first thing that I''ve ever built that''s been intended to programmatically send email. I''m looking at examples in AWR and also on the wiki. I feel that I sort of have things set up right but I''m getting an error I can''t grok: Net::SMTPFatalError in Home#email_list 550 5.7.1 Unable to relay for jpfeifer-fVOoFLC7IWo@public.gmane.org /app/controllers/home_controller.rb:34:in `email_list'' script/server:54 jpfeifer-fVOoFLC7IWo@public.gmane.org is my email and is pulled from my database table I''m set up like this: Controller: def email_list email = Email.find(:first) MailList::deliver_send_email(email) end Model: class MailList < ActionMailer::Base def send_email(email) @recipients = email.address @from = ''email-Jbz+COfnBiiw5LPnMra/2Q@public.gmane.org'' @subject = ''thanks for entering the contest'' end end Environment: # Include your app''s configuration here: ActionMailer::Base.perform_deliveries = true ActionMailer::Base.raise_delivery_errors = true ActionMailer::Base.default_charset = "utf-8" ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.server_settings = { :address => "mail.address.ca", :port => 25, :domain => "www.address.ca", :authentication => :login, :user_name => "username", :password => "password"} so to me it looks like there is something wrong with sending in SMTP. I''m not really familiar with much of this so I much appreciate advice. Thanks, Jason -- Posted via http://www.ruby-forum.com/.
Typically the address for outgoing mail would start with smtp, such as smtp.address.ca. Addresses beginning with mail are typically for incoming mail (POP). Also, you may or may not need authentication for sending mail. On Dec 17, 2005, at 4:25 PM, Jason Pfeifer wrote:> To start out I''ll say that this is the first thing that I''ve ever > built > that''s been intended to programmatically send email. I''m looking at > examples in AWR and also on the wiki. I feel that I sort of have > things > set up right but I''m getting an error I can''t grok: > > Net::SMTPFatalError in Home#email_list > 550 5.7.1 Unable to relay for jpfeifer-fVOoFLC7IWo@public.gmane.org > > /app/controllers/home_controller.rb:34:in `email_list'' > script/server:54 > > jpfeifer-fVOoFLC7IWo@public.gmane.org is my email and is pulled from my database table > > I''m set up like this: > > Controller: > > def email_list > email = Email.find(:first) > MailList::deliver_send_email(email) > end > > Model: > > class MailList < ActionMailer::Base > def send_email(email) > @recipients = email.address > @from = ''email-Jbz+COfnBiiw5LPnMra/2Q@public.gmane.org'' > @subject = ''thanks for entering the contest'' > end > end > > Environment: > > # Include your app''s configuration here: > > ActionMailer::Base.perform_deliveries = true > ActionMailer::Base.raise_delivery_errors = true > ActionMailer::Base.default_charset = "utf-8" > ActionMailer::Base.delivery_method = :smtp > ActionMailer::Base.server_settings = { > :address => "mail.address.ca", > :port => 25, > :domain => "www.address.ca", > :authentication => :login, > :user_name => "username", > :password => "password"} > > so to me it looks like there is something wrong with sending in SMTP. > I''m not really familiar with much of this so I much appreciate advice. > > Thanks, > > Jason > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Steven Smith wrote:> Typically the address for outgoing mail would start with smtp, such > as smtp.address.ca. Addresses beginning with mail are typically for > incoming mail (POP). Also, you may or may not need authentication > for sending mail.Okay, I guess the other thing I forgot to note is that I am trying to get this runnning on my Windows localhost with WebRICK. I am not even aware whether or not I can send email in this fashion, is it possible to run like this? -- Posted via http://www.ruby-forum.com/.
It should work as far as I know. Also, you''ll need the actual address of an smtp server (not sure if address.ca was just an example or an actual smtp server). On Dec 17, 2005, at 4:50 PM, Jason Pfeifer wrote:> Steven Smith wrote: >> Typically the address for outgoing mail would start with smtp, such >> as smtp.address.ca. Addresses beginning with mail are typically for >> incoming mail (POP). Also, you may or may not need authentication >> for sending mail. > > Okay, I guess the other thing I forgot to note is that I am trying to > get this runnning on my Windows localhost with WebRICK. I am not even > aware whether or not I can send email in this fashion, is it > possible to > run like this? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Steven Smith wrote:> It should work as far as I know. Also, you''ll need the actual > address of an smtp server (not sure if address.ca was just an example > or an actual smtp server).I''ve done a bit of fiddling, I have my smtp server from the company that is my cable internet provider: ''shawmail.vc.shawcable.net'' then I have all the other authorization stuff like username, password, filled out correctly for what works with my email. I am getting this error: ''533 5.7.1 AUTH command is not enabled.'' -- Posted via http://www.ruby-forum.com/.
The smtp server mail not require authentication for sending mail. Try changing your server_settings as follows and see what happens: ActionMailer::Base.server_settings = { :address => "shawmail.vc.shawcable.net", :port => 25, :domain => "???", :authentication => :plain } On Dec 17, 2005, at 5:50 PM, Jason Pfeifer wrote:> Steven Smith wrote: >> It should work as far as I know. Also, you''ll need the actual >> address of an smtp server (not sure if address.ca was just an example >> or an actual smtp server). > > I''ve done a bit of fiddling, I have my smtp server from the company > that > is my cable internet provider: ''shawmail.vc.shawcable.net'' > > then I have all the other authorization stuff like username, password, > filled out correctly for what works with my email. > > I am getting this error: > > ''533 5.7.1 AUTH command is not enabled.'' > > > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Steven Smith wrote:> The smtp server mail not require authentication for sending mail. > Try changing your server_settings as follows and see what happens: > > ActionMailer::Base.server_settings = { > :address => "shawmail.vc.shawcable.net", > :port => 25, > :domain => "???", > :authentication => :plain > }Okay awesome! I got a single email address firing. Now, I am trying to pass the email variable as an array to the Email model that does the sending. controller def email_list email = Email.find(:all) MailList::deliver_send_email(email) end model class MailList < ActionMailer::Base def send_email(email) @recipients = email.address @from = ''address-JEej1PRyDx4@public.gmane.org'' @subject = ''thanks for signing up'' end end but I get rails thinking it''s a method undefined method `address'' for #<Array:0x372bc00> I''m not sure the syntax to access the address field of my database table. It was working with one email address, but how do I package and pass the array to the Mailer? -- Posted via http://www.ruby-forum.com/.
Update: I got this working: def email_list email = Email.find(:all) email.each { |address| MailList::deliver_send_email(address) } end but for some reason that doesn''t feel like the proper rails way to do it. The docs say that @recipients can be an array, but I am having trouble passing the array and then grabbing the column I want (''address'') -- Posted via http://www.ruby-forum.com/.
I think it''s looking for an array of strings as in: @recipients = ["joe-O5WfVfzUwx8@public.gmane.org", "bob-O5WfVfzUwx8@public.gmane.org"] As an alternate solution, I believe you could pass the email array to send_email (as your first example had it) and iterate over the array there adding the address for each email to @recipients. On Dec 17, 2005, at 6:54 PM, Jason Pfeifer wrote:> Update: > > I got this working: > > def email_list > email = Email.find(:all) > email.each { |address| MailList::deliver_send_email(address) } > end > > but for some reason that doesn''t feel like the proper rails way to do > it. The docs say that @recipients can be an array, but I am having > trouble passing the array and then grabbing the column I want > (''address'') > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Steven Smith wrote:> I think it''s looking for an array of strings as in: > > @recipients = ["joe-O5WfVfzUwx8@public.gmane.org", "bob-O5WfVfzUwx8@public.gmane.org"] > > As an alternate solution, I believe you could pass the email array to > send_email (as your first example had it) and iterate over the array > there adding the address for each email to @recipients.Ok. As far as the way I have it right now, is there anything wrong with doing it the way I have it? Trying to develop good habits from the start :-) -- Posted via http://www.ruby-forum.com/.
I think it''s looking for an array of strings as in: @recipients = ["joe-O5WfVfzUwx8@public.gmane.org", "bob-O5WfVfzUwx8@public.gmane.org"] As an alternate solution, I believe you could pass the email array to send_email (as your first example had it) and iterate over the array there adding the address for each email to @recipients. On Dec 17, 2005, at 6:54 PM, Jason Pfeifer wrote:> Update: > > I got this working: > > def email_list > email = Email.find(:all) > email.each { |address| MailList::deliver_send_email(address) } > end > > but for some reason that doesn''t feel like the proper rails way to do > it. The docs say that @recipients can be an array, but I am having > trouble passing the array and then grabbing the column I want > (''address'') > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Not as far as I know. How you implement it just depends on whether or not you want to send one email to all the recipients (To: bob-O5WfVfzUwx8@public.gmane.org, joe-O5WfVfzUwx8@public.gmane.org) or a separate email to each recipient (one to bob, and one to joe). On Dec 17, 2005, at 7:13 PM, Jason Pfeifer wrote:> Steven Smith wrote: >> I think it''s looking for an array of strings as in: >> >> @recipients = ["joe-O5WfVfzUwx8@public.gmane.org", "bob-O5WfVfzUwx8@public.gmane.org"] >> >> As an alternate solution, I believe you could pass the email array to >> send_email (as your first example had it) and iterate over the array >> there adding the address for each email to @recipients. > > Ok. As far as the way I have it right now, is there anything wrong > with > doing it the way I have it? Trying to develop good habits from the > start :-) > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Hi , I am trying to get Action mailer work for me. and I have a problem figuring out what is the ''mail'' object thats passed to the deliver method. How do I create it? the doc says mail = MyMailer.create_some_email but what is this supposed to return? Thanks Vivek On 12/18/05, Jason Pfeifer <jpfeifer-fVOoFLC7IWo@public.gmane.org> wrote:> > Steven Smith wrote: > > The smtp server mail not require authentication for sending mail. > > Try changing your server_settings as follows and see what happens: > > > > ActionMailer::Base.server_settings = { > > :address => "shawmail.vc.shawcable.net", > > :port => 25, > > :domain => "???", > > :authentication => :plain > > } > > Okay awesome! I got a single email address firing. Now, I am trying to > pass the email variable as an array to the Email model that does the > sending. > > controller > > def email_list > email = Email.find(:all) > MailList::deliver_send_email(email) > end > > model > > class MailList < ActionMailer::Base > def send_email(email) > @recipients = email.address > @from = ''address-JEej1PRyDx4@public.gmane.org'' > @subject = ''thanks for signing up'' > end > end > > but I get rails thinking it''s a method > > undefined method `address'' for #<Array:0x372bc00> > > I''m not sure the syntax to access the address field of my database > table. It was working with one email address, but how do I package and > pass the array to the Mailer? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
It is a TMail::Mail object. http://railsmanual.org/module/TMail If you have questions about other objects / classes, etc. you can print out the class of an object as follows: mail = MyMailer.create_some_email logger.debug("mail class: #{mail.class}") On Dec 30, 2005, at 7:22 AM, Vivek Krishna wrote:> Hi , > I am trying to get Action mailer work for me. and I have a > problem figuring out what is the ''mail'' object thats passed to the > deliver method. > How do I create it? > the doc says > mail = MyMailer.create_some_email > > but what is this supposed to return? > Thanks > Vivek > > > On 12/18/05, Jason Pfeifer <jpfeifer-fVOoFLC7IWo@public.gmane.org > wrote: > Steven Smith wrote: > > The smtp server mail not require authentication for sending mail. > > Try changing your server_settings as follows and see what happens: > > > > ActionMailer::Base.server_settings = { > > :address => "shawmail.vc.shawcable.net ", > > :port => 25, > > :domain => "???", > > :authentication => :plain > > } > > Okay awesome! I got a single email address firing. Now, I am > trying to > pass the email variable as an array to the Email model that does the > sending. > > controller > > def email_list > email = Email.find(:all) > MailList::deliver_send_email(email) > end > > model > > class MailList < ActionMailer::Base > def send_email(email) > @recipients = email.address > @from = ''address-JEej1PRyDx4@public.gmane.org'' > @subject = ''thanks for signing up'' > end > end > > but I get rails thinking it''s a method > > undefined method `address'' for #<Array:0x372bc00> > > I''m not sure the syntax to access the address field of my database > table. It was working with one email address, but how do I package > and > pass the array to the Mailer? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails