SMTP errror handling

When I try to send the email with invalid recipient like
[email protected] I get following error 550 unknown recipient. I try
to catch the error with begin and catch but error is not caught.
Any idea

If you want to rescue an exception you need to use rescue, not
catch( which is something rather different in ruby)

Sent from my iPhone

Sorry I mean rescue but I type catch. My code is like this

begin
UserMailer.deliver_sent_to_friend(from,recipient, subject, message)

flash[:notice] = "Message sent."

rescue
flash[:notice]=“Message not sent”
end

However problem persist.

On Aug 4, 4:52 pm, Frederick C. [email protected]