# Trouble Sending Emails

**URL:** <https://www.ruby-forum.com/t/trouble-sending-emails/113857>\
**Category:** Ruby\
**Created:** [September 5, 2007, 5:40pm UTC](https://www.ruby-forum.com/t/trouble-sending-emails/113857 "2007-09-05T17:40:18Z")\
**Posts on this page:** 5\
**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 5, 2007, 5:40pm UTC](https://www.ruby-forum.com/t/trouble-sending-emails/113857/1 "2007-09-05T17:40:18Z")

</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:** ![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 5, 2007, 6:23pm UTC](https://www.ruby-forum.com/t/trouble-sending-emails/113857/2 "2007-09-05T18:23:25Z")

</div>

> -----Original Message-----  
> From: Matt W. [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]  
> 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?

---

<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 5, 2007, 7:04pm UTC](https://www.ruby-forum.com/t/trouble-sending-emails/113857/3 "2007-09-05T19:04:40Z")

</div>

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

> 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?

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

–  
Rick DeNatale

My blog on Ruby  
[http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)

---

<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 6, 2007, 7:46pm UTC](https://www.ruby-forum.com/t/trouble-sending-emails/113857/4 "2007-09-06T19:46:51Z")

</div>

On Sep 5, 10:03 pm, Peña, Botp [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> # =\> “250 Ok: queued as 20F73116D1AA\n”
> 
> it arrived on mail\_server.
> 
> your mail admin can better help you.
> 
> kind regards -botp

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

---

<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 6, 2007, 6:03am UTC](https://www.ruby-forum.com/t/trouble-sending-emails/113857/5 "2007-09-06T06:03:51Z")

</div>

From: Matt W. [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]

# 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  
a. the server mail\_server received your email (w ack 250 Ok)  
b. and further replied that it queued your mail w queueid 20F73116D1AA  
(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
