# Trouble Sending Emails

**URL:** <https://rubytalk.org/t/trouble-sending-emails/40400>\
**Category:** ruby-talk\
**Created:** [5 September 2007 15:39 UTC](https://rubytalk.org/t/trouble-sending-emails/40400 "2007-09-05T15:39:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_White2](https://avatars.discourse-cdn.com/v4/letter/m/f14d63/32.png) [@Matt\_White2](https://rubytalk.org/u/Matt_White2)\
**Post date:** [5 September 2007 15:39 UTC](https://rubytalk.org/t/trouble-sending-emails/40400/1 "2007-09-05T15:39:21Z")

</div>

Hello,

I run a script nightly which used to send e-mails when it successfully completed, but it no longer does. I'm not sure which configurations I need to check as I haven't used net/smtp much (I inherited this script). Any ideas?

irb(main):001:0\> require 'net/smtp'  
=\> true  
irb(main):002:0\> supplierid = 8  
=\> 8  
irb(main):003:0\> body = "Subject: Product Import succeeded for supplier #{supplierid} at #{Time.now.to\_s}\r\n\r\n"  
=\> "Subject: Product Import succeeded for supplier 8 at Wed Sep 05 09:25:26 -0600 2007\r\n\r\n"  
irb(main):004:0\> Net::SMTP.start(mail\_server, 25, helo\_domain, username, password, :login) do |smtp|  
irb(main):005:1\* smtp.send\_message(body, from\_address, to\_address)  
irb(main):006:1\> end  
=\> "250 Ok: queued as 20F73116D1AA\n"

...but the mail never arrives. Thanks for any assistance!

Matt

> **···**
>
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center.  
> [http://autos.yahoo.com/green\_center/](http://autos.yahoo.com/green_center/)

---

<div class="post-metadata">

**Author:** ![Phil](https://avatars.discourse-cdn.com/v4/letter/p/e95f7d/32.png) [@Phil](https://rubytalk.org/u/Phil)\
**Post date:** [5 September 2007 16:22 UTC](https://rubytalk.org/t/trouble-sending-emails/40400/2 "2007-09-05T16:22:48Z")

</div>

Have you checked the mail server for the message ID it is supposedly queued  
as? And what doe the logs of the script and/or mail server say in regard to  
the messages?

If the mails are sent to a special account, can this account be checked by a  
mail client?

> **···**
>
> > -----Original Message-----  
> > From: Matt White [mailto:whitethunder922@yahoo.com]  
> > Sent: Wednesday, September 05, 2007 5:39 PM  
> > To: ruby-talk ML  
> > Subject: Trouble Sending Emails
> > 
> > =\> "250 Ok: queued as 20F73116D1AA\n"
> > 
> > ...but the mail never arrives. Thanks for any assistance!
> 
> --  
> Phillip Gawlowski

---

<div class="post-metadata">

**Author:** ![\_Pena\_Botp1](https://avatars.discourse-cdn.com/v4/letter/_/94ad74/32.png) [@\_Pena\_Botp1](https://rubytalk.org/u/_Pena_Botp1)\
**Post date:** [6 September 2007 04:03 UTC](https://rubytalk.org/t/trouble-sending-emails/40400/3 "2007-09-06T04:03:19Z")

</div>

# irb(main):003:0\> body = "Subject: Product Import  
# succeeded for supplier #{supplierid} at #{Time.now.to\_s}\r\n\r\n"  
# =\> "Subject: Product Import succeeded for supplier 8 at Wed  
# Sep 05 09:25:26 -0600 2007\r\n\r\n"  
# irb(main):004:0\> Net::SMTP.start(mail\_server, 25,  
# helo\_domain, username, password, :login) do |smtp|  
# irb(main):005:1\* smtp.send\_message(body,  
# from\_address, to\_address)  
# irb(main):006:1\> end  
# =\> "250 Ok: queued as 20F73116D1AA\n"

at this point  
&nbsp;&nbsp;a. the server mail\_server received your email (w ack 250 Ok)  
&nbsp;&nbsp;b. and further replied that it queued your mail w queueid 20F73116D1AA  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(surely that reply and the queueid did not come fr ruby, right?)

ergo your ruby script is fine.

# ...but the mail never arrives. Thanks for any assistance!

it arrived on mail\_server.

your mail admin can better help you.

kind regards -botp

> **···**
>
> From: Matt White [[mailto:whitethunder922@yahoo.com](mailto:whitethunder922@yahoo.com)]

---

<div class="post-metadata">

**Author:** ![Rick\_DeNatale1](https://avatars.discourse-cdn.com/v4/letter/r/bbce88/32.png) [@Rick\_DeNatale1](https://rubytalk.org/u/Rick_DeNatale1)\
**Post date:** [5 September 2007 17:02 UTC](https://rubytalk.org/t/trouble-sending-emails/40400/4 "2007-09-05T17:02:18Z")

</div>

And it could be running afoul of whatever anti-spam measures might  
exist between the source and recipient.

> **···**
>
> On 9/5/07, Phil \<cmdjackryan@googlemail.com\> wrote:
> 
> > \> -----Original Message-----  
> > \> From: Matt White [mailto:whitethunder922@yahoo.com]  
> > \> Sent: Wednesday, September 05, 2007 5:39 PM  
> > \> To: ruby-talk ML  
> > \> Subject: Trouble Sending Emails  
> > \>  
> > \> =\> "250 Ok: queued as 20F73116D1AA\n"  
> > \>  
> > \> ...but the mail never arrives. Thanks for any assistance!
> > 
> > Have you checked the mail server for the message ID it is supposedly queued  
> > as? And what doe the logs of the script and/or mail server say in regard to  
> > the messages?
> > 
> > If the mails are sent to a special account, can this account be checked by a  
> > mail client?
> 
> --  
> Rick DeNatale
> 
> My blog on Ruby  
> [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)

---

<div class="post-metadata">

**Author:** ![Matt\_White1](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@Matt\_White1](https://rubytalk.org/u/Matt_White1)\
**Post date:** [6 September 2007 17:45 UTC](https://rubytalk.org/t/trouble-sending-emails/40400/5 "2007-09-06T17:45:11Z")

</div>

Thanks for the help. I will have the server admin look into it for me.

> **···**
>
> On Sep 5, 10:03 pm, Peña, Botp \<b...@delmonte-phil.com\> wrote:
> 
> > From: Matt White [mailto:whitethunder...@yahoo.com]  
> > # irb(main):003:0\> body = "Subject: Product Import  
> > # succeeded for supplier #{supplierid} at #{Time.now.to\_s}\r\n\r\n"  
> > # =\> "Subject: Product Import succeeded for supplier 8 at Wed  
> > # Sep 05 09:25:26 -0600 2007\r\n\r\n"  
> > # irb(main):004:0\> Net::SMTP.start(mail\_server, 25,  
> > # helo\_domain, username, password, :login) do |smtp|  
> > # irb(main):005:1\* smtp.send\_message(body,  
> > # from\_address, to\_address)  
> > # irb(main):006:1\> end  
> > # =\> "250 Ok: queued as 20F73116D1AA\n"
> > 
> > at this point  
> > &nbsp;&nbsp;a. the server mail\_server received your email (w ack 250 Ok)  
> > &nbsp;&nbsp;b. and further replied that it queued your mail w queueid 20F73116D1AA  
> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(surely that reply and the queueid did not come fr ruby, right?)
> > 
> > ergo your ruby script is fine.
> > 
> > # ...but the mail never arrives. Thanks for any assistance!
> > 
> > it arrived on mail\_server.
> > 
> > your mail admin can better help you.
> > 
> > kind regards -botp
