I don't fancy that you check for a connection. As you said, when there is no connection to rails and the remote mail server (or dns) rails throws an exception. So you should catch that exception and handle it accordingly.
def create
@vendor = Vendor.new(params[:vendor])
if @vendor.save
begin
VendorMailer.registration_confirmation(@vendor).deliver
flash[:success] = "Vendor Added Successfully"
redirect_to amain_path
rescue SocketError => e
flash[:success] = "Vendor Added Successfully mail is not send"
redirect_to amain_path
end
else
render 'new'
end
end