quit $smtp->quit This method sends the QUIT command to the remote SMTP server and closes the socket connection.