Sending mails using SMTP server Ruby on rails

I have faced some problem to indentify the domain which are not exist…i
do not want to send mails to the invalid domain.Now i have made an
application which sends e-mail,but mails are sent to all the domains
those are not valid…Pls give me a proper solution ,so that i can check
whether the domain exists or not then i will send the mail to the valid