Last active
November 13, 2020 09:20
-
-
Save hmnhf/da95ecd81240bbe96836 to your computer and use it in GitHub Desktop.
Revisions
-
hmnhf revised this gist
Nov 13, 2020 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,10 +6,10 @@ Mail.defaults do delivery_method :smtp, { port: 25, address: "smtp.mandrillapp.com", user_name: ENV["MANDRILL_USERNAME"], password: ENV["MANDRILL_PASSWORD"] } end -
hmnhf revised this gist
Nov 13, 2020 . 1 changed file with 14 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,6 @@ # I was encountering this exception: Net::SMTPServerBusy: 401 4.1.7 Bad sender address syntax # First I searched to see if there's any documentation around this issue but didn't find anything, # so I wrote this snippet to find those invalid characters. require 'mail' @@ -14,19 +13,17 @@ } end (32..255).each_with_object([]) do |codepoint, invalid_chrs| chr = codepoint.chr begin Mail.deliver do to ENV["MYEMAIL"] from "John Doe #{chr} <john@doe.com>" subject 'A transactional email from Mandrill!' end rescue Net::SMTPServerBusy invalid_chrs.push(chr) end end # => ["\"", "(", ",", ":", ";", "<", ">", "["] -
hmnhf renamed this gist
May 31, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
hmnhf renamed this gist
May 31, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
hmnhf created this gist
May 31, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ # I was encountering this exception # Net::SMTPServerBusy: 401 4.1.7 Bad sender address syntax # First I searched to see if there's any documentation around this issue, # didn't find anything, so I wrote this snippet to find those invalid characters require 'mail' Mail.defaults do delivery_method :smtp, { :port => 25, :address => "smtp.mandrillapp.com", :user_name => ENV["MANDRILL_USERNAME"], :password => ENV["MANDRILL_PASSWORD"] } end def check_if_char_is_invalid c @invalid_chars ||= [] mail = Mail.deliver do to ENV["MYEMAIL"] from "John Doe #{c} <john@doe.com>" subject 'A transactional email from Mandrill!' end rescue Net::SMTPServerBusy puts "invalid char: #{c}" @invalid_chars.push(c).uniq! end (32..255).each { |x| check_if_char_is_invalid x.chr } @invalid_chars # => ["\"", "(", ",", ":", ";", "<", ">", "["]