# Internal server error(500) when attempting to sendmail

**URL:** <https://www.ruby-forum.com/t/internal-server-error-500-when-attempting-to-sendmail/190268>\
**Category:** Rails\
**Created:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/internal-server-error-500-when-attempting-to-sendmail/190268 "2010-06-17T16:22:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/internal-server-error-500-when-attempting-to-sendmail/190268/1 "2010-06-17T16:22:34Z")

</div>

Hello,

I have an application that, when you create an appointment it sends an  
email to the client to say someone has just booked.

Locally, this works fine (i’m just using sendmail)

Locally - all email tests have come through - no problem.

However - when I copy all the files onto the server and attempt to  
create a booking, it comes up with the 500 page. The error below if  
taken from my server logs:

Please NOte - I have another site which uses the same sendmail  
functionality, and i’ve never had a problem.

Any ideas?

OpenSSL::SSL::SSLError (hostname was not match with the server  
certificate):  
/usr/lib/ruby/1.8/openssl/ssl.rb:123:in `post_connection_check' /usr/lib/ruby/1.8/net/smtp.rb:582:in`tlsconnect’  
/usr/lib/ruby/1.8/net/smtp.rb:562:in `do_start' /usr/lib/ruby/1.8/net/smtp.rb:525:in`start’  
app/controllers/appointments\_controller.rb:60:in `create' app/controllers/appointments_controller.rb:52:in`create’  
/usr/lib/ruby/1.8/phusion\_passenger/rack/request\_handler.rb:92:in  
`process_request' /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb: 207:in`main\_loop’  
/usr/lib/ruby/1.8/phusion\_passenger/railz/application\_spawner.rb:  
385:in `start_request_handler' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb: 343:in`handle\_spawn\_application’  
/usr/lib/ruby/1.8/phusion\_passenger/utils.rb:184:in `safe_fork' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb: 341:in`handle\_spawn\_application’  
/usr/lib/ruby/1.8/phusion\_passenger/abstract\_server.rb:352:in  
` __send__' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in`main\_loop’  
/usr/lib/ruby/1.8/phusion\_passenger/abstract\_server.rb:196:in  
`start_synchronously' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in`start’  
/usr/lib/ruby/1.8/phusion\_passenger/railz/application\_spawner.rb:  
209:in `start' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in`spawn\_rails\_application’  
/usr/lib/ruby/1.8/phusion\_passenger/abstract\_server\_collection.rb:  
126:in `lookup_or_add' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in`spawn\_rails\_application’  
/usr/lib/ruby/1.8/phusion\_passenger/abstract\_server\_collection.rb:  
80:in `synchronize' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb: 79:in`synchronize’  
/usr/lib/ruby/1.8/phusion\_passenger/spawn\_manager.rb:255:in  
`spawn_rails_application' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in`spawn\_application’  
/usr/lib/ruby/1.8/phusion\_passenger/spawn\_manager.rb:287:in  
`handle_spawn_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in` **send** ’  
/usr/lib/ruby/1.8/phusion\_passenger/abstract\_server.rb:352:in  
`main_loop' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in`start\_synchronously’  
/usr/lib/phusion\_passenger/passenger-spawn-server:61

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/internal-server-error-500-when-attempting-to-sendmail/190268/2 "2010-06-17T16:22:47Z")

</div>

On Jun 13, 7:51 pm, RubyonRails\_newbie [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> create a booking, it comes up with the 500 page. The error below if  
> taken from my server logs:
> 
> Please NOte - I have another site which uses the same sendmail  
> functionality, and i’ve never had a problem.
> 
> Any ideas?

It’s complaining that the ssl certificate that the smtp server is  
using is for a different host.

Fred

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [June 17, 2010, 4:26pm UTC](https://www.ruby-forum.com/t/internal-server-error-500-when-attempting-to-sendmail/190268/3 "2010-06-17T16:26:20Z")

</div>

_note_  
I have done some digging, and one forum suggests:

Open base.rb in ActionMailer and comment the following line:

smtp.enable\_starttls\_auto if smtp.respond\_to?(:enable\_starttls\_auto)

However, I have another app on the same server that runs and sends  
mail fine. So i don’t tink i need to change this…

Can anyone please help??

Many Thanks

On 13 June, 19:51, RubyonRails\_newbie [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [June 17, 2010, 4:26pm UTC](https://www.ruby-forum.com/t/internal-server-error-500-when-attempting-to-sendmail/190268/4 "2010-06-17T16:26:21Z")

</div>

re: It’s complaining that the ssl certificate that the smtp server is  
using is for a different host.

how do I change this then?

It works fine on my other app that runs on the same server…

On 13 June, 21:09, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![craigrails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/c2a13f/32.png) [@craigrails](https://www.ruby-forum.com/u/craigrails)\
**Post date:** [June 17, 2010, 4:26pm UTC](https://www.ruby-forum.com/t/internal-server-error-500-when-attempting-to-sendmail/190268/5 "2010-06-17T16:26:59Z")

</div>

sorted.

i just needed the sendmail referenc in the production.rb file.

works fine now.

thanks Frederick

On 13 June, 21:12, RubyonRails\_newbie [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
