I've also been trying to skip Pony out and use Mail directly with this
code:
post '/contact' do
require 'mail'
Mail.deliver do
from params[:from]
to '[email protected]'
subject params[:subject]
body params[:content]
port '587'
delivery_method :smtp,{
:address => 'smtp.sendgrid.net',
:port => '587',
:enable_starttls_auto => true,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:authentication => :plain,
:domain => ENV['SENDGRID_DOMAIN']
}
end
redirect '/'
end
But it falls over because it doesn't recognise the use of params,
anybody know how to get round this?
cheers,
DAZ
On Aug 23, 4:03 pm, DAZ <[email protected]> wrote:
> I've got it working on Heroku! Thanks Michal!
>
> To answer my own questions:
> 1. Yes, SENDGRID_USERNAME and SENDGRID_PASSWORD are installed when you
> install the sendgrid addon.
> 2. ENV['SENDGRID_DOMAIN'] is used for the domain and this is also set.
>
> I get this error message:
> Not a Rails app, can't install the plugin quick_sendgrid
>
> I presume this isn't a problem?
>
> Anybody got any ideas how I would get this to also work locally? What
> would I have to install?
>
> cheers,
>
> DAZ
>
> On Aug 23, 11:58 am, DAZ <[email protected]> wrote:
>
>
>
> > Thanks Michal, This is brilliant, just a couple of questions:
>
> > 1. Where do I get SENDGRID_USERNAME and SENDGRID_PASSWORD from, or are
> > they set up automatically when I install the Sendgrid addon?
> > 2. What do I change the HELO domain to?
>
> > cheers,
>
> > DAZ
>
> > On Aug 23, 11:53 am, misza222 <[email protected]> wrote:
>
> > > Hi Daz,
>
> > > How about that:
> > > ==============
> > > post '/contact' do
> > > require 'pony'
> > > Pony.mail(
> > > :to => 'your-email-address',
> > > :from => params[:from],
> > > :subject => params[:subject],
> > > :body => params[:content],
> > > :via => :smtp,
> > > :via_options => {
> > > :address => 'smtp.sendgrid.net',
> > > :port => '587', # 587 for encryption
> > > :enable_starttls_auto => true,
> > > :user_name => ENV['SENDGRID_USERNAME'],
> > > :password => ENV['SENDGRID_PASSWORD'],
> > > :authentication => :plain,
> > > # :plain, :login, :cram_md5, no auth by default
> > > :domain => 'change-that-domain.com' # the
> > > HELO domain provided by the client to the server
> > > })
> > > flash[:notice] = "Thank you for your e-mail."
>
> > > redirect '/'
> > > end
> > > ===============
> > > Add necessary checks on params, change HELO domain and it's done I
> > > suppose.
>
> > > Michal
>
> > > On Aug 22, 8:41 pm, DAZ <[email protected]> wrote:
>
> > > > Hi,
>
> > > > I'm using Sinatra and would like to create a very simple contact page
> > > > that will send me an email when filled in.
>
> > > > Is this possible on Heroku using Sendgrid and Pony? Do I need to also
> > > > use a gmail account?
>
> > > > Has anybody got any experience of this or advice?
>
> > > > cheers,
>
> > > > DAZ
--
You received this message because you are subscribed to the Google Groups
"Heroku" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/heroku?hl=en.