Comments (34)
Recently ran into this issue on mail 2.4.3 (not sure if it has been fixed yet), but the problem for me was that the auto generated content-id contains your computer hostname, and my computer hostname had an illegal character (apostrophe) in it, causing the auto generated content-id to fail at parsing.
The fix is to change your computer hostname to something without illegal characters.
For mac:
scutil --set HostName YOUR_NEW_HOSTNAME
from mailcatcher.
Done. mikel/mail#1073
from mailcatcher.
It sounds like an ill-formed message, could you please attach the full source of the message? Feel free to anonymise it a bit if you like, or email it to me directly (as an attachment): [email protected]
Sounds like you might've found a bug in the mail gem. ;-)
from mailcatcher.
I started getting this same bug today. What's weird is that I didn't have the issue yesterday, and I didn't change the e-mail. @mmrobins or @sj26 any progress?
from mailcatcher.
It actually went away for me briefly the other day when I upgraded my Rails app to 3.2.10, so I figured something there fixed it - but it's back today. Also I reverted the Rails upgrade and tested it and still have this problem. I emailed sj26 the full message source, and will anonymize the content so I can post it here.
from mailcatcher.
The only thing I can think of is config changes to my system (I restarted this morning)
I also have a slightly different stacktrace (annoymized):
.../rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/smtp.rb:948:in `check_response': 550 Message rejected (Net::SMTPFatalError)
from .../rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/smtp.rb:902:in `data'
from .../rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/smtp.rb:660:in `block in send_message'
from .../rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/smtp.rb:849:in `rcptto_list'
from .../rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/smtp.rb:660:in `send_message'
from .../ruby/1.9.1/gems/mail-2.4.4/lib/mail/network/delivery_methods/smtp.rb:145:in `block in deliver!'
from .../rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/net/smtp.rb:520:in `start'
from .../ruby/1.9.1/gems/mail-2.4.4/lib/mail/network/delivery_methods/smtp.rb:144:in `deliver!'
from .../ruby/1.9.1/gems/mail-2.4.4/lib/mail/message.rb:2034:in `do_delivery'
from .../ruby/1.9.1/gems/mail-2.4.4/lib/mail/message.rb:229:in `block in deliver'
from .../ruby/1.9.1/gems/actionmailer-3.2.8/lib/action_mailer/base.rb:415:in `block in deliver_mail'
from .../ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `block in instrument'
from .../ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from .../ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/notifications.rb:123:in `instrument'
from .../ruby/1.9.1/gems/actionmailer-3.2.8/lib/action_mailer/base.rb:413:in `deliver_mail'
from .../ruby/1.9.1/gems/mail-2.4.4/lib/mail/message.rb:229:in `deliver'
from tmp/test_mailcatcher.rb:36:in `<main>'
Message source:
Date: Fri, 04 Jan 2013 17:53:10 -0500
From: test@localhost
To: [email protected]
Subject: testing mail
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="--==_mimepart_50e75d56c7f2e_10d73fcfd8435ad46286f";
charset=UTF-8
Content-Transfer-Encoding: 7bit
----==_mimepart_50e75d56c7f2e_10d73fcfd8435ad46286f
Date: Fri, 04 Jan 2013 17:53:10 -0500
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
text only e-mail
----==_mimepart_50e75d56c7f2e_10d73fcfd8435ad46286f
Date: Fri, 04 Jan 2013 17:53:10 -0500
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
<html><body><p><b>hellowlrld</b>text</p></body></html>
----==_mimepart_50e75d56c7f2e_10d73fcfd8435ad46286f--
from mailcatcher.
Simple test script to test via actionmailer
[Updated to fix extra end
]
require 'rubygems'
require 'bundler/setup'
require 'action_mailer'
#http://stackoverflow.com/questions/4951310/actionmailer-3-without-rails
#http://stackoverflow.com/questions/4805583/rails-mailer-without-view
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "localhost",
:port => 1025 #mailcatcher
}
# ActionMailer::Base.view_paths= File.dirname(__FILE__)
class Mailer < ActionMailer::Base
def daily_email
@var = "var"
mail( :to => "[email protected]",
:from => "test@localhost",
:subject => "testing mail") do |format|
format.text do
render :text => "text only e-mail"
end
format.html do
render :text => "<html><body><p><b>hellowlrld</b>text</p></body></html>"
end
end
end
end
email = Mailer.daily_email
puts email
email.deliver
from mailcatcher.
@phillbaker That script triggers it for me too, nice. I think there's an extra end
in your script, but after I got rid of that I get the following:
─ [0]% ruby mailer_test.rb
Date: Fri, 04 Jan 2013 15:16:47 -0800
From: test@localhost
To: [email protected]
Subject: testing mail
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="--==_mimepart_50e762df7edb5_5fef3ffa6d034ed441068";
charset=UTF-8
Content-Transfer-Encoding: 7bit
----==_mimepart_50e762df7edb5_5fef3ffa6d034ed441068
Date: Fri, 04 Jan 2013 15:16:47 -0800
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8 Content-Transfer-Encoding: 7bit
text only e-mail
----==_mimepart_50e762df7edb5_5fef3ffa6d034ed441068
Date: Fri, 04 Jan 2013 15:16:47 -0800
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
<html><body><p><b>hellowlrld</b>text</p></body></html>
----==_mimepart_50e762df7edb5_5fef3ffa6d034ed441068--
/Users/matt/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/smtp.rb:948:in `check_response': 550 Message rejected (Net::SMTPFatalError)
from /Users/matt/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/smtp.rb:902:in `data'
from /Users/matt/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/smtp.rb:660:in `block in send_message'
from /Users/matt/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/smtp.rb:849:in `rcptto_list'
from /Users/matt/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/smtp.rb:660:in `send_message'
from /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mail-2.4.4/lib/mail/network/delivery_methods/smtp.rb:145:in `block in deliver!'
from /Users/matt/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/smtp.rb:520:in `start'
from /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mail-2.4.4/lib/mail/network/delivery_methods/smtp.rb:144:in `deliver!'
from /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mail-2.4.4/lib/mail/message.rb:2034:in `do_delivery'
from /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mail-2.4.4/lib/mail/message.rb:229:in `block in deliver'
from /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/actionmailer-3.2.9/lib/action_mailer/base.rb:415:in `block in deliver_mail'
from /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.9/lib/active_support/notifications.rb:123:in `block in instrument'
from /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.9/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
from /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.2.9/lib/active_support/notifications.rb:123:in `instrument'
from /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/actionmailer-3.2.9/lib/action_mailer/base.rb:413:in `deliver_mail'
from /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mail-2.4.4/lib/mail/message.rb:229:in `deliver'
from mailer_test.rb:36:in `<main>'
And the mailcatcher logs:
─ [0]% mailcatcher -f -vStarting MailCatcher==> smtp://127.0.0.1:1025==> http://127.0.0.1:1080
*** Error receiving message: {:sender=>"<test@localhost>", :recipients=>["<[email protected]>"], :source=>"Date: Fri, 04 Jan 2013 15:15:13 -0800\nFrom: test@localhost\nTo: [email protected]\nSubject: testing mail\nMime-Version: 1.0\nContent-Type: multipart/alternative;\n boundary=\"--==_mimepart_50e7628178bca_5f763fdefd434ed423089\";\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n\n\n----==_mimepart_50e7628178bca_5f763fdefd434ed423089\nDate: Fri, 04 Jan 2013 15:15:13 -0800\nMime-Version: 1.0\nContent-Type: text/plain;\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\ntext only e-mail\n\n----==_mimepart_50e7628178bca_5f763fdefd434ed423089\nDate: Fri, 04 Jan 2013 15:15:13 -0800\nMime-Version: 1.0\nContent-Type: text/html;\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n<html><body><p><b>hellowlrld</b>text</p></body></html>\n\n----==_mimepart_50e7628178bca_5f763fdefd434ed423089--\n"} Exception: undefined method `match' for nil:NilClass Backtrace: /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mail-2.4.4/lib/mail/utilities.rb:104:in `unbracket' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mail-2.4.4/lib/mail/part.rb:29:in `cid' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mailcatcher-0.5.10/lib/mail_catcher/mail.rb:51:in `block in add_message' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mailcatcher-0.5.10/lib/mail_catcher/mail.rb:48:in `each' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mailcatcher-0.5.10/lib/mail_catcher/mail.rb:48:in `add_message' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mailcatcher-0.5.10/lib/mail_catcher/smtp.rb:45:in `receive_message' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/em/protocols/smtpserver.rb:532:in `process_data_line' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/em/protocols/smtpserver.rb:196:in `receive_line' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:64:in `receive_data' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mailcatcher-0.5.10/lib/mail_catcher.rb:134:in `run!' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mailcatcher-0.5.10/bin/mailcatcher:4:in `<top (required)>' /Users/matt/.rvm/gems/ruby-1.9.3-p125/bin/mailcatcher:19:in `load' /Users/matt/.rvm/gems/ruby-1.9.3-p125/bin/mailcatcher:19:in `<main>' Please submit this as an issue at http://github.com/sj26/mailcatcher/issues *** Error receiving message: {:sender=>"<test@localhost>", :recipients=>["<[email protected]>"], :source=>"Date: Fri, 04 Jan 2013 15:16:47 -0800\nFrom: test@localhost\nTo: [email protected]\nSubject: testing mail\nMime-Version: 1.0\nContent-Type: multipart/alternative;\n boundary=\"--==_mimepart_50e762df7edb5_5fef3ffa6d034ed441068\";\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n\n\n----==_mimepart_50e762df7edb5_5fef3ffa6d034ed441068\nDate: Fri, 04 Jan 2013 15:16:47 -0800\nMime-Version: 1.0\nContent-Type: text/plain;\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\ntext only e-mail\n\n----==_mimepart_50e762df7edb5_5fef3ffa6d034ed441068\nDate: Fri, 04 Jan 2013 15:16:47 -0800\nMime-Version: 1.0\nContent-Type: text/html;\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n<html><body><p><b>hellowlrld</b>text</p></body></html>\n\n----==_mimepart_50e762df7edb5_5fef3ffa6d034ed441068--\n"} Exception: undefined method `match' for nil:NilClass Backtrace: /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mail-2.4.4/lib/mail/utilities.rb:104:in `unbracket'
/Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mail-2.4.4/lib/mail/part.rb:29:in `cid' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mailcatcher-0.5.10/lib/mail_catcher/mail.rb:51:in `block in add_message' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mailcatcher-0.5.10/lib/mail_catcher/mail.rb:48:in `each' /Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mailcatcher-0.5.10/lib/mail_catcher/mail.rb:48:in `add_message'
/Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mailcatcher-0.5.10/lib/mail_catcher/smtp.rb:45:in `receive_message'
/Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/em/protocols/smtpserver.rb:532:in `process_data_line'
/Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/em/protocols/smtpserver.rb:196:in `receive_line'
/Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:64:in `receive_data'
/Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
/Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
/Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
/Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'
/Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run'
/Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mailcatcher-0.5.10/lib/mail_catcher.rb:134:in `run!'
/Users/matt/.rvm/gems/ruby-1.9.3-p125/gems/mailcatcher-0.5.10/bin/mailcatcher:4:in `<top (required)>'
/Users/matt/.rvm/gems/ruby-1.9.3-p125/bin/mailcatcher:19:in `load'
/Users/matt/.rvm/gems/ruby-1.9.3-p125/bin/mailcatcher:19:in `<main>'
Please submit this as an issue at http://github.com/sj26/mailcatcher/issues
from mailcatcher.
@sj26, to follow up on this, do you think this is a bug outside of mailcathcher (in mail gem, rails, some system component)?
What other information would help to track this down? OS/Ruby/Gemfiles? Could this be an encoding issue?
from mailcatcher.
Hey guys, sorry I've been a bit flat out, I'll take a look tonight and get back to you, but yeah it looks to me like an upstream problem, probably in the mail gem's parsing code.
from mailcatcher.
I actually can't replicate this with the example email you supplied.
What version of the mail gem are you both using when able to replicate the issue? That might be a clue.
from mailcatcher.
Thanks, I do appreciate the help.
So looks like latest mailcatcher specifies mail ~> 2.3
, rails (actionmailer) 3.2.8 and 3.2.10 specify ~> 2.4.4
, so the chosen gem is mail (2.4.4). Current mail version is 2.5.3, about a month old. Looks like quite a few bugs have been patched.
I'm on ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.2.1].
There are several other devs working on this exact same repo without this issue, so my guess is that it's not necessarily mailcatcher itself.
from mailcatcher.
Keep in mind mailcatcher runs as a ruby gem, outside of bundler, so it'll use whatever the latest compatible version of the mail gem you have installed is. Perhaps your devs have differing versions of mail? Try updating mail and see what happens.
from mailcatcher.
Ah, interesting. I actually bundle exec mailcatcher
, so mail is only the bundled one.
I did try with the following setup:
i18n (0.6.1)
multi_json (1.5.0)
activesupport (3.2.10)
daemons (1.1.9)
eventmachine (1.0.0) with native extensions
haml (3.1.7)
mime-types (1.19)
polyglot (0.3.3)
treetop (1.4.12)
mail (2.5.3) <- latest mail
rack (1.4.3)
rack-protection (1.3.2)
tilt (1.3.3)
sinatra (1.3.3)
thin (1.5.0) with native extensions
skinny (0.2.3)
sqlite3 (1.3.6) with native extensions
mailcatcher (0.5.10)
Using bundler (1.2.3)
Same error:
Starting MailCatcher
==> smtp://127.0.0.1:1025
==> http://127.0.0.1:1080
*** Error receiving message: {:sender=>"<[email protected]>", :recipients=>["<[email protected]>"], :source=>"Date: Mon, 07 Jan 2013 21:45:08 -0500\nFrom: General Assembly <[email protected]>\nTo: [email protected]\nSubject: Confirmation for Front End Web Development\nMime-Version: 1.0\nContent-Type: multipart/alternative;\n boundary=\"--==_mimepart_50eb88343c171_57413ffbe1c35ad890373\";\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n\n\n----==_mimepart_50eb88343c171_57413ffbe1c35ad890373\nDate: Mon, 07 Jan 2013 21:45:08 -0500\nMime-Version: 1.0\nContent-Type: text/plain;\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\nDear Auz Foo,\n\nThanks for registering for our Front End Web Development course! This email confirms your acceptance into the course beginning on Tuesday, 1 January at\n\nGA Campus East,\n902 Broadway, 4th Floor,\nNew York,\nNY 10010,\nUSA\n\n\nYour order confirmation number is 13. Your payment schedule is below. A separate email will be sent seven (7) days in advance of when each payment is due, with a link to the payment portal.\n\nYour Payment Schedule:\n$333.33 due on 2013-01-15\n$333.33 due on 2013-01-22\n$333.34 due on 2013-01-29\nTotal Cost of Tuition: $1,000.00\n\nMake a payment now: http://core.dev/store/payment/42\n\nPlease keep this email for your records in your record-keeping system of choice (email archive, file cabinet, shoe box, etc.).\n\nWe'll follow-up with a GA Student Welcome Kit and pre-class instructions a few days prior to the course start date. We look forward to seeing you in real life! \n\nEmail us at \"General Assembly\" <[email protected]> if you have any questions.\n\n----==_mimepart_50eb88343c171_57413ffbe1c35ad890373\nDate: Mon, 07 Jan 2013 21:45:08 -0500\nMime-Version: 1.0\nContent-Type: text/html;\n charset=UTF-8\nContent-Transfer-Encoding: 7bit\n\n<html>\n <body>\n <div style=\"width: 500px; margin: 0 auto; font-size: 16px; line-height: 24px\">\n <div style=\"margin-top: 25px; margin-bottom: 35px; padding-bottom: 15px; border-bottom: 5px solid black\">\n <a href=\"http://generalassemb.ly\" style=\"color: #ff0033\">\n <img border=\"0\" src=\"http://image.mailbox.generalassemb.ly/lib/fe6515707166017f7d10/m/1/ga-logo.png\" alt=\"General Assembly\" />\n </a>\n </div>\n <div>\n <p>Dear Auz Foo,</p>\n \n <p>Thanks for registering for our <span style=\"font-weight: bold\">Front End Web Development</span> course! This email confirms your acceptance into the course beginning on <span style=\"font-weight: bold\">Tuesday, 1 January</span> in <span style=\"font-weight: bold\">GA Campus East,\n902 Broadway, 4th Floor,\nNew York,\nNY 10010,\nUSA\n</span>.</p>\n \n <p><span style=\"font-weight: bold\">Your order confirmation number is 13</span>. Your payment schedule is below. A separate email will be sent seven (7) days in advance of when each payment is due, with a link to the payment portal.</p>\n </div>\n \n <div style=\"background: #f2f2f2; padding: 20px; margin: 30px auto;\">\n <p style=\"margin-top: 0; padding-top: 5px; font-size: 20px; text-align: center\">Your Payment Schedule:</p>\n <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n <thead>\n <tr>\n <td style=\"width: 84%; padding-bottom: 10px; font-weight: bold\">Date Due</td>\n <td style=\"width: 16%; padding-bottom: 10px; text-align: right; font-weight: bold\">Amount</td>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td style=\"width: 84%; padding-top: 10px; padding-bottom: 10px; border-top: 1px solid #666666\">2013-01-15</td>\n <td style=\"width: 16%; padding-top: 10px; padding-bottom: 10px; border-top: 1px solid #666666; text-align: right\">$333.33</td>\n </tr>\n <tr>\n <td style=\"width: 84%; padding-top: 10px; padding-bottom: 10px; border-top: 1px solid #666666\">2013-01-22</td>\n <td style=\"width: 16%; padding-top: 10px; padding-bottom: 10px; border-top: 1px solid #666666; text-align: right\">$333.33</td>\n </tr>\n <tr>\n <td style=\"width: 84%; padding-top: 10px; padding-bottom: 10px; border-top: 1px solid #666666\">2013-01-29</td>\n <td style=\"width: 16%; padding-top: 10px; padding-bottom: 10px; border-top: 1px solid #666666; text-align: right\">$333.34</td>\n </tr>\n </tbody>\n <tfoot>\n <td style=\"width: 84%; padding-top: 10px; border-top: 1px solid #666666; font-style: italic; text-align: right\">Total Cost of Tuition:</td>\n <td style=\"width: 16%; padding-top: 10px; border-top: 1px solid #666666; font-weight: bold; text-align: right\">$1,000.00</td>\n </tr>\n </tfoot>\n </table>\n <a href=\"http://core.dev/store/payment/42\" style=\"display: block; width: 210px; background: #ff0033; color: #ffffff; text-decoration: none; text-align: center; padding: 10px; font-family: arial; font-weight: bold; margin: 10px auto\">Make a Payment Now</a>\n </div>\n\n <p>Please keep this email for your records in your record-keeping system of choice (email archive, file cabinet, shoe box, etc.).</p>\n\n <p>We'll follow-up with a GA Student Welcome Kit and pre-class instructions a few days prior to the course start date. We look forward to seeing you in real life!</p> \n\n <p><a href=\"mailto:"General Assembly" <[email protected]>\" style=\"color:#ff0033\">Email us</a> if you have any questions. </p>\n\n <br />\n </div>\n </body>\n</html>\n\n\n\n----==_mimepart_50eb88343c171_57413ffbe1c35ad890373--\n"}
Exception: undefined method `match' for nil:NilClass
Backtrace:
...mailcatcher/.bundle/ruby/1.9.1/gems/mail-2.5.3/lib/mail/utilities.rb:104:in `unbracket'
...mailcatcher/.bundle/ruby/1.9.1/gems/mail-2.5.3/lib/mail/part.rb:29:in `cid'
...mailcatcher/.bundle/ruby/1.9.1/gems/mailcatcher-0.5.10/lib/mail_catcher/mail.rb:51:in `block in add_message'
...mailcatcher/.bundle/ruby/1.9.1/gems/mailcatcher-0.5.10/lib/mail_catcher/mail.rb:48:in `each'
...mailcatcher/.bundle/ruby/1.9.1/gems/mailcatcher-0.5.10/lib/mail_catcher/mail.rb:48:in `add_message'
...mailcatcher/.bundle/ruby/1.9.1/gems/mailcatcher-0.5.10/lib/mail_catcher/smtp.rb:45:in `receive_message'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/smtpserver.rb:532:in `process_data_line'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/smtpserver.rb:196:in `receive_line'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:64:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/em/protocols/linetext2.rb:65:in `receive_data'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'
...mailcatcher/.bundle/ruby/1.9.1/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run'
...mailcatcher/.bundle/ruby/1.9.1/gems/mailcatcher-0.5.10/lib/mail_catcher.rb:134:in `run!'
...mailcatcher/.bundle/ruby/1.9.1/gems/mailcatcher-0.5.10/bin/mailcatcher:4:in `<top (required)>'
...mailcatcher/.bundle/ruby/1.9.1/bin/mailcatcher:23:in `load'
...mailcatcher/.bundle/ruby/1.9.1/bin/mailcatcher:23:in `<main>'
Please submit this as an issue at http://github.com/sj26/mailcatcher/issues
from mailcatcher.
OH okay. Your email doesn't have a Message-ID or part Content-IDs which are required in RFC 2822. Normally the mail gem just generates one for any parts without one, but for some reason it seems to be skipping in your case. How are you constructing this email? Whatever is generating it should be providing a content id.
I think this breaks because mailcatcher use content ids (or CIDs) to load the different parts inside a multipart html and text email. I still can't replicate the failure on my machine. I initially had trouble replicating this because I used the mailcatcher's catchmail
script which wraps the outgoing email in the mail gem before sending it off which adds content-ids and such required things before it hits mailcatcher:
Date: Mon, 07 Jan 2013 21:45:08 -0500
From: General Assembly <[email protected]>
To: [email protected]
Message-ID: <[email protected]>
Subject: Confirmation for Front End Web Development
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="--==_mimepart_50eb88343c171_57413ffbe1c35ad890373";
charset=UTF-8
Content-Transfer-Encoding: 7bit
----==_mimepart_50eb88343c171_57413ffbe1c35ad890373
Date: Mon, 07 Jan 2013 21:45:08 -0500
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-ID: <[email protected]>
Dear Auz Foo,
...
(see Content-ID: <[email protected]>
)
I've been explicitly writing out an SMTP session with the literal email you've posted, but still no failure.
Try adding Content-ID
to your source email and see if that fixes the error on your end. If it does, try to track down inside the mail gem why it's not populating content_id on the Part, which part it actually is in the message, etc. Even better, make a failing test case against the mail gem!
from mailcatcher.
Fascinating, thanks for digging into this. Everything is generated using ActionMailer, so I'm puzzled why headers would be missing. I'll dig around and see.
Thanks!
from mailcatcher.
Just for posterity sake, in my config/environment/development.rb
I added:
require 'digest/sha2'
...
config.action_mailer.default = { 'Message-ID' => "<#{Digest::SHA2.hexdigest(Time.now.to_i.to_s)}@example.com>" }
which resolved the issue. Not sure why this is an issue on some setups of the same rails project, and not others.
We can probably close this issue, thanks @sj26!
from mailcatcher.
Weighing in - I'm working in the same workgroup as @mmrobins above (on a different project), and I've had the coming/going 550 problem as well. I tried the action_mailer default workaround @phillbaker suggested above, and didn't have any luck. I'll try a few other solutions and share my findings, but it's the same missing message-id issue at its core.
from mailcatcher.
@marktabler, fascinating. Were you able to reproduce the error with the test script? What OS/ruby/rails/etc. are you on? Does anyone else in the group have a similar issue?
I'm curious to see if we can establish a common denominator.
from mailcatcher.
Sorry for the delay in responding, but the problem has vanished again. I can't begin to fathom why this is an intermittent issue; the environment and the code just aren't changing in any way that I'm aware. Currently my emails go out and the test script runs, and that's with or without the workaround @phillbaker posted earlier. If it comes back I'll try to catch more data, including test script results.
from mailcatcher.
I'm getting the same error code, but with a slightly different message:
Net::SMTPFatalError - 550 Cannot receive from specified address <[email protected]>: Unauthenticated senders not allowed
:
/Users/stuey/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/smtp.rb:948:in `check_response'
/Users/stuey/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/smtp.rb:917:in `getok'
/Users/stuey/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/smtp.rb:832:in `mailfrom'
/Users/stuey/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/smtp.rb:659:in `send_message'
(gem) mail-2.4.4/lib/mail/network/delivery_methods/smtp.rb:145:in `block in deliver!'
/Users/stuey/.rvm/rubies/ruby-1.9.3-p374/lib/ruby/1.9.1/net/smtp.rb:520:in `start'
(gem) mail-2.4.4/lib/mail/network/delivery_methods/smtp.rb:144:in `deliver!'
(gem) mail-2.4.4/lib/mail/message.rb:2034:in `do_delivery'
(gem) mail-2.4.4/lib/mail/message.rb:229:in `block in deliver'
(gem) actionmailer-3.2.11/lib/action_mailer/base.rb:415:in `block in deliver_mail'
(gem) activesupport-3.2.11/lib/active_support/notifications.rb:123:in `block in instrument'
(gem) activesupport-3.2.11/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
(gem) activesupport-3.2.11/lib/active_support/notifications.rb:123:in `instrument'
(gem) actionmailer-3.2.11/lib/action_mailer/base.rb:413:in `deliver_mail'
(gem) mail-2.4.4/lib/mail/message.rb:229:in `deliver'
app/controllers/messages_controller.rb:101:in `send_email'
I'm using Rails 3.2.11 on MRI 1.9.3-p374 on OS X 10.8.2
I've tried @phillbaker's workaround but it didn't change the error. I've looked at the output for the emails in the log and it is generating Content IDs and a Message ID
I've tested my code on my staging environment (Heroku with SendGrid) and messages are being sent without a problem.
from mailcatcher.
@thicksoup that's a different issue which I've never seen before. Could you please send me the MailCatcher log output and the full message source you are trying to send?
from mailcatcher.
@thicksoup be careful, too, because "Cannot receive from specified address <...>: Unauthenticated senders not allowed" is not a message that I can see anywhere in eventmachine's SMTP handling, so you may not even be sending through mailcatcher.
from mailcatcher.
@mmrobins without a repeatable trigger we can't really diagnose this. If you come up with a way to repeatedly trigger the error please let me know, but for now I'll close the issue.
from mailcatcher.
@sj26 Thanks for looking into it. I don't even get the error anymore, so definitely don't know how to get it to be repeatable. I have a hunch that it might had had something to do with a gemset that used at some point that I'm not using now. That is I may have run mailcatcher from a directory where there was a problem with the other gems installed in an rvm gemset specified in the .rvmrc, but wherever I run mailcatcher from now doesn't have that problem. If I figure anything out for how to get this to happen reliably I'll update here.
from mailcatcher.
I'm getting the same error as @thicksoup. Should I open a new issue or post the info here?
from mailcatcher.
@amree can you post an example which triggers the error please? Preferably the full source of an email body sent to mailcatcher, and any logs you get from mailcatcher in response.
from mailcatcher.
I'm sorry, but I've forgotten where I saw the log. But the problem still exists. Mailcatcher didn't catch any email and there's no error at all in the mailcatcher log (I ran it using mailcatcher -f -v
). I'm testing it using forgot password from Devise.
I followed your guide from the main page and added these codes in development.rb
:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
This is the message from Rails server log:
Sent mail to [email protected] (3516ms)
Date: Tue, 02 Jul 2013 20:50:08 +0800
From: [email protected]
Reply-To: [email protected]
To: [email protected]
Message-ID: <[email protected]>
Subject: Reset password instructions
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
<p>Hello [email protected]!</p>
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
<p><a href="http://localhost:3000/users/password/edit?reset_password_token=QP4kFmTzSqMUH">Change my password</a></p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>
Redirected to http://localhost:3000/users/sign_in
Completed 302 Found in 3590ms (ActiveRecord: 0.0ms)
I tried sending email using plain old ruby with this script and it mailcatcher did catch it successfully:
#!/usr/bin/env ruby
require 'net/smtp'
require 'time'
def send_message(smtp, from, to)
msg = <<END_OF_MESSAGE
From: #{from}
Reply-to: #{from}
To: #{to}
Subject: Reset password instructions
Date: #{Time.now.rfc2822}
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
Hello world!
END_OF_MESSAGE
smtp.send_message(msg, from, to)
end
Net::SMTP.start('localhost', 1025) do |smtp|
send_message(smtp, '[email protected]', '[email protected]')
end
I tried checking /var/log/mail.log
but there's nothing useful. By the way, the full source code for my app is available at http://github.com/amree/bertukar/.
from mailcatcher.
@amree your config/environments/development.rb does not appear to have the mail catcher config as you describe. If you added it then tried sending mail then you may have forgotten to restart rails. That you are seeing the message text in the rails logs means something in your application is misconfigured.
from mailcatcher.
Ah, I didn't mention it earlier, I'm still testing mailcatcher, so, the new codes haven't been pushed to the repo. But as I've mentioned earlier, I've added these two lines in the config:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
from mailcatcher.
I have the same error without using mailcatcher and still haven't any ideas why this happened. Tried to use gmail and Mandrill with different ENV configs and always have this problem.
from mailcatcher.
@ekurennyy check the various logs involved—both client and server side.
from mailcatcher.
When:
=============== Phusion Passenger Standalone web server started ===============
Environment: production
there will be a mistake: Send E-mail
[2016-12-24T16:03:08.167819 #2061] INFO -- : [c3bbd1b9-167b-4e7c-8dfb-070e25950976] Completed 500 Internal Server Error in 1430ms (ActiveRecord: 16.9ms)
FATAL -- : [c3bbd1b9-167b-4e7c-8dfb-070e25950976] Net::SMTPFatalError (553 authentication is required,126 smtp1,C8mowADnHOa6K15YNQFmAw--.10596S3 1482566588
The reason:
I set the value of the variable system is wrong, should be set in the/etc/profile or/etc/environment, I set in ~ /. bashrc below
Can't read ,lead to send mail mistakes
from mailcatcher.
@dounan that sounds like a mail gem bug! It should be aware of the content encoding of the message and use compatible content-id. Maybe you could add an issue?
from mailcatcher.
Related Issues (20)
- mailcatcher - PHP 8.0./8.1 HOT 8
- uninitialized constant Thin::Server::Fixnum (NameError) HOT 2
- Doesn't work on rhel8-like distr in docker with arm arch HOT 4
- Display name to/from not showing on web/api
- ruby-3.0.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:1490:in `event_callback': undefined method `close' for 9:Integer (NoMethodError) HOT 2
- Not compatible with newest version of Rails 7.0.4.3 HOT 4
- Add clarity about message delivery in the readme HOT 1
- can not start mailcatcher HOT 3
- Thin::Server::Fixnum HOT 1
- Send email to stdout HOT 1
- Eventmachine fails to compile on Windows HOT 15
- Exception: undefined method `length' for nil:NilClass HOT 1
- Fixnum is uninitialized HOT 2
- Installation fails
- Liveness and Readiness probles HOT 1
- No longer updates just-sent emails HOT 5
- Update gem spec minimum versions HOT 3
- 0.9.1.beta2 does not work with Ruby 3.3 HOT 5
- Issue with Displaying Logs in MailCatcher HOT 1
- docker image not working HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mailcatcher.