# Trouble Sending Emails

**URL:** <https://www.ruby-forum.com/t/trouble-sending-emails/113756>\
**Category:** Ruby\
**Created:** [September 4, 2007, 6:16pm UTC](https://www.ruby-forum.com/t/trouble-sending-emails/113756 "2007-09-04T18:16:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwalsh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Post date:** [September 4, 2007, 6:16pm UTC](https://www.ruby-forum.com/t/trouble-sending-emails/113756/1 "2007-09-04T18:16:28Z")

</div>

Hello,

One of my scripts that used to send e-mails on successful completion  
has stopped sending e-mails. Using ruby-debug, I found that it is  
indeed reaching those lines of code but no e-mail ever gets sent. I  
can send e-mails using the exact same code from irb. Here’s what I  
have:

body = “Subject: Product Import succeeded for supplier #{supplierid}  
at #{Time.now.to\_s}\r\n\r\n”  
Net::SMTP.start(mailserver, 25, helo\_domain, email\_address,  
password, :login) do |smtp|  
smtp.send\_message(body, from\_address, to\_address)  
end

Any ideas where I can look or what I can try to solve this problem?  
Like I said, it works from irb when I cut-and-paste this code…  
Thanks!

---

<div class="post-metadata">

**Author:** ![mwalsh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Post date:** [September 4, 2007, 6:20pm UTC](https://www.ruby-forum.com/t/trouble-sending-emails/113756/2 "2007-09-04T18:20:29Z")

</div>

Is your irb session running as the same user the script is being run as?

On 9/4/07, Matt W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> at #{Time.now.to\_s}\r\n\r\n"

–  
“Hey brother Christian with your high and mighty errand, Your actions  
speak  
so loud, I can’t hear a word you’re saying.”

-Greg Graffin (Bad Religion)
