tags:

views:

52

answers:

3
def mailTo(subject,msg,folks)
begin
Net::SMTP.start('localhost', 25) do |smtp|
  smtp.send_message "MIME-Version: 1.0\nContent-type: text/html\nSubject: #{subject}\n#{msg}\n#{DateTime.now}\n", '[email protected]', folks
end


rescue => e
    puts "Emailing Sending Error - #{e}"
  end
end

when the HTML is VERY large I get this exception

Emailing Sending Error - 552 5.6.0 Headers too large (32768 max)

how can i get a larger html above max to work with Net::SMTP in Ruby

A: 

I believe that this is a problem with SMTP and sending that email/message. Try reducing the number of people you send a message to at one time. For example, if you are sending a message to 500 people at once, then maybe send the message to 50 different people at a time instead (sending the message ten times).

omizzle
I am only sending the email to 1 person
Joe Stein
+1  A: 

This might not be a restriction imposed by the library, but rather a restriction imposed by the service you are using to send. It kinda depends on just how huge of an HTML file we're talking about here, but your mail server may simply not let you send things that large. This probably can not be addressed with simple programming; you're gonna have to come up with a creative solution, like sending through a different service or breaking up the message.

Matchu
A: 

Hi, 2 quick observations:

a) "552 5.6.0 Headers too large"

this is a SMTP error message. It's coming from your SMTP server, not your code. Your code is just bubbling it up.

b)Headers are supposed to be seperated by "\r\n", not just "\n". Try fixing that part of your code.

Cheers!
Dave

dave wanta