# How to implement SMTP's "RCPT To" func in ruby

**URL:** <https://www.ruby-forum.com/t/how-to-implement-smtps-rcpt-to-func-in-ruby/89585>\
**Category:** Ruby\
**Created:** [March 21, 2007, 11:22am UTC](https://www.ruby-forum.com/t/how-to-implement-smtps-rcpt-to-func-in-ruby/89585 "2007-03-21T11:22:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lnes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c0e974/32.png) [@lnes](https://www.ruby-forum.com/u/lnes)\
**Post date:** [March 21, 2007, 11:22am UTC](https://www.ruby-forum.com/t/how-to-implement-smtps-rcpt-to-func-in-ruby/89585/1 "2007-03-21T11:22:02Z")

</div>

Hi all:  
I want do a email reality validation, it need use a smtp’s command  
“RCPT to”. I found a php implement there \<[Enterprise PHP Development Platform and Services | Zend by Perforce](http://www.zend.com/zend/)  
spotlight/ev12apr.php#Heading16\>, but I can’t find a ruby edition. I  
search many stuff, like simplehttp and Net::Smtp, I found maybe there  
is no way to implemnt “RCPT to”. Now, I just can validate the domain,  
can’t validate single mail address.  
Can you help me??

Thanks

---

<div class="post-metadata">

**Author:** ![lnes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/c0e974/32.png) [@lnes](https://www.ruby-forum.com/u/lnes)\
**Post date:** [March 21, 2007, 11:48am UTC](https://www.ruby-forum.com/t/how-to-implement-smtps-rcpt-to-func-in-ruby/89585/2 "2007-03-21T11:48:11Z")

</div>

lnes wrote:

> Hi all:  
> I want do a email reality validation, it need use a smtp’s command  
> “RCPT to”. I found a php implement there \<[http://www.zend.com/zend/](http://www.zend.com/zend/)  
> spotlight/ev12apr.php#Heading16\>, but I can’t find a ruby edition. I  
> search many stuff, like simplehttp and Net::Smtp, I found maybe there  
> is no way to implemnt “RCPT to”. Now, I just can validate the domain,  
> can’t validate single mail address.

First, the method you want to use is impractical at best, as a  
mail-server might just say “Yes, I have that e-mail address”, even if it  
doesn’t exist, or might even say “I don’t have an email address like  
that”. Thank the world’s spammers for that.

The only way to verify an email address is sending an email there, and  
require a link to an activation code.  
(There was a similar discussion on the security-basics ML on  
[securityfocus.com](http://securityfocus.com) a while ago.)

Second, you can just use Ruby’s Telnet library: establish a telnet  
session on port 25 (SMTP), and send the required commands. Those can be  
found either in the postfix manual, or in the SMTP RFC.

> Can you help me??  
> No. 😉
