pony

Sending mail with Pony and Sinatra

筅森魡賤 提交于 2019-12-11 09:33:42
问题 I am trying to send an email from a contact form (built in HTML) with the Pony Gem within sinatra, I have followed the docs but something must be missing. This is the Pony config get '/contact' do erb :contact, :layout => :layout end post '/contact' do require 'pony' Pony.mail({ :from => params[:name], :to => 'myemailaddress', :subject => params[:name] + "has contacted you via the Website", :body => params[:comment], :via => :smtp, :via_options => { :address => 'smtp.gmail.com', :port => '587

How do I test Pony emailing in a Sinatra app, using rspec?

♀尐吖头ヾ 提交于 2019-12-11 02:29:46
问题 I'm trying out email_spec, which says it supports Pony, but I'm not sure how I'd go about testing emails in a sinatra app. The examples in the readme show usages with rails ActionMailer , but not in Pony. Not precious about using email_spec, so any other ideas for testing emails using rspec in sinatra are welcomed =) 回答1: I ended up looking at the pony spec file, and stealing code from it to write my specs =) This is what I have: ./spec/spec_helper.rb def do_not_send_email Pony.stub!(:deliver

Sending email with attachments in Ruby with the Pony Gem

余生颓废 提交于 2019-12-09 21:14:52
问题 I am writing a script that is going to be sending out emails to a list of people and with this email there is going to be an attachment. I keep running into this issue: /usr/local/lib/ruby/1.9.1/net/smtp.rb:942:in 'check_response': 552 sorry, that message size exceeds my databytes limit (#5.3.4) (Net::SMTPFatalError) The attached file is only 110kb Code: Pony.mail( :to => to, :from => 'Me <me@me.com>', :subject => html_entity_decoder.decode(options[:subject]), :html_body => "#{options[:body]}

Pony yandex.ru and mail.ru specifics

霸气de小男生 提交于 2019-12-08 19:41:29
I am creating a form in Sinatra that will be sending data to an e-mail on submit using Pony gem. This is my code so far: post '/pemco' do Pony.mail( :from => params[:name] + "<" + params[:email] + ">", :to => '___@yandex.ru', :subject => params[:name] + " has contacted you", :body => params[:message], :via => :smtp, :via_options => { :address => 'smtp.yandex.ru', :port => '465', :enable_starttls_auto => true, :user_name => '___', :password => '___', :authentication => :plain }) redirect '/' end I press submit , response pends for some time and then I get Net::ReadTimeout file: protocol.rb

How to format email for gmail?

允我心安 提交于 2019-12-08 05:02:36
问题 I wrapped the email's body in <html><body><pre> . Show original in gmail gives me actually how I want the email to be formatted: Mime-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Ant run name : Basics of Edumate Overall result : pass Ant run took: 4 minutes 15 seconds -------------------------- Details for all test suits -------------------------- login : Pass AddCycleTemplate: Pass AddCycleTemplate: Pass AddAcademicYear : Pass AddAcademicYear : Pass But

Deploying Sinatra app on Dreamhost/Passenger with custom gems

隐身守侯 提交于 2019-12-05 22:42:51
I've got a Sinatra app that I'm trying to run on Dreamhost that makes use of pony to send email. In order to get the application up and running at the very beginning (before adding pony), I had to gem unpack rack and gem unpack sinatra into the vendor/ directory, so this was my config.ru: require 'vendor/rack/lib/rack' require 'vendor/sinatra/lib/sinatra' set :run, false set :environment, :production set :views, "views" require 'public/myapp.rb' run Sinatra::Application I have already done gem install pony and gem unpack pony (into vendor/). Afterwards, I tried adding require 'vendor/sinatra

Sending email with attachments in Ruby with the Pony Gem

。_饼干妹妹 提交于 2019-12-04 17:45:23
I am writing a script that is going to be sending out emails to a list of people and with this email there is going to be an attachment. I keep running into this issue: /usr/local/lib/ruby/1.9.1/net/smtp.rb:942:in 'check_response': 552 sorry, that message size exceeds my databytes limit (#5.3.4) (Net::SMTPFatalError) The attached file is only 110kb Code: Pony.mail( :to => to, :from => 'Me <me@me.com>', :subject => html_entity_decoder.decode(options[:subject]), :html_body => "#{options[:body]}".html_safe, :attachments => {File.basename("#{attachment}") => File.read("#{attachment}")}, :headers =

Contact form in ruby, sinatra, and haml

左心房为你撑大大i 提交于 2019-12-03 02:54:18
问题 I'm new to all three, and I'm trying to write a simple contact form for a website. The code I have come up with is below, but I know there are some fundamental problems with it (due to my inexperience with sinatra). Any help at getting this working would be appreciated, I can't seem to figure out/find the documentation for this sort of thing. haml code from the contact page: %form{:name => "email", :id => "email", :action => "/contact", :method => "post", :enctype => "text/plain"} %fieldset

Contact form in ruby, sinatra, and haml

試著忘記壹切 提交于 2019-12-02 16:45:53
I'm new to all three, and I'm trying to write a simple contact form for a website. The code I have come up with is below, but I know there are some fundamental problems with it (due to my inexperience with sinatra). Any help at getting this working would be appreciated, I can't seem to figure out/find the documentation for this sort of thing. haml code from the contact page: %form{:name => "email", :id => "email", :action => "/contact", :method => "post", :enctype => "text/plain"} %fieldset %ol %li %label{:for => "message[name]"} Name: %input{:type => "text", :name => "message[name]", :class =

Little Pony and Sort by Shift

一曲冷凌霜 提交于 2019-11-26 20:19:10
***Little Pony and Sort by Shift*** One day, Twilight Sparkle is interested in how to sort a sequence of integers a1, a2, …, an in non-decreasing order. Being a young unicorn, the only operation she can perform is a unit shift. That is, she can move the last element of the sequence to its beginning: a1, a2, …, an → an, a1, a2, …, an - 1. Help Twilight Sparkle to calculate: what is the minimum number of operations that she needs to sort the sequence? Input The first line contains an integer n (2 ≤ n ≤ 105). The second line contains n integer numbers a1, a2, …, an (1 ≤ ai ≤ 105). Output If it’s