📄 smtp.h
字号:
* @throws SSLException * On any uncommon event that occurs while sending * data through the encrypted socket. */ void sendHELO (); /** * Send the MAIL command. * * @throws TransferException * If the SMTP server responds with an error msg. * @throws TransferException * On any uncommon event that occurs while sending * data through the socket. * @throws SSLException * On any uncommon event that occurs while sending * data through the encrypted socket. */ void sendMAILFROM (); /** * Send the RCPT command. * * @param msg The message that the RCPT TO cms belongs to. * * @throws TransferException * If the SMTP server responds with an error msg. * @throws TransferException * On any uncommon event that occurs while sending * data through the socket. * @throws SSLException * On any uncommon event that occurs while sending * data through the encrypted socket. */ void sendRCPTTO (Message &msg); /** * Send the DATA command. * * @param msg The message that the RCPT TO cms belongs to. * * @throws TransferException * If the SMTP server responds with an error msg. * @throws TransferException * On any uncommon event that occurs while sending * data through the socket. * @throws SSLException * On any uncommon event that occurs while sending * data through the encrypted socket. */ void sendDATA (Message &msg); /** * Send the QUIT command. * * @throws TransferException * If the SMTP server responds with an error msg. * @throws TransferException * On any uncommon event that occurs while sending * data through the socket. * @throws SSLException * On any uncommon event that occurs while sending * data through the encrypted socket. */ void sendQUIT (); /** * Start the SSL handshaking process. * * @throws TransferException * If the SMTP server responds with an error msg. * @throws TransferException * On any uncommon event that occurs while sending * data through the socket. * @throws SSLException * On any uncommon event that occurs while sending * data through the encrypted socket. * @throws IOException * If one of ca_file or ca_dir is not accessible. */ void startSSL (); /** * Evaluates the SMTP reply and throws an * TransferException if a fatal error occured or * prints a warning message to stderr on any * not fatal error. * * @param answer The response string from the SMTP server that * should be evaluated. * @param is_221_fatal If true a SMTP response with the ID 221 will * result in a TransferException. * * @throws TransferException * If the SMTP answer is a fatal error msg. */ void evalResponse (const string &answer, bool is_221_fatal = true); /** * Authenticates the user using the given AUTH_TYPE. * * @throws TransferException * If the SMTP server responds with an error msg. * @throws TransferException * On any uncommon event that occurs while sending * data through the socket. * @throws SSLException * On any uncommon event that occurs while sending * data through the encrypted socket. * @throws AuthenticationFailedException * If the given authentication method is not * supported by the SMTP server. * @throws DecodeException * If the BASE64 data was invalid. */ void authenticate (); /** * Authenticates the user using the LOGIN method. * * @param username The username that should be used for authentication. * @param passwd The password that should be used for authentication. * * @throws TransferException * If the SMTP server responds with an error msg. * @throws TransferException * On any uncommon event that occurs while sending * data through the socket. * @throws SSLException * On any uncommon event that occurs while sending * data through the encrypted socket. */ void auth_login (const string &username, const string &password); /** * Authenticates the user using the PLAIN method. * * @param username The username that should be used for authentication. * @param passwd The password that should be used for authentication. * * @throws TransferException * If the SMTP server responds with an error msg. * @throws TransferException * On any uncommon event that occurs while sending * data through the socket. * @throws SSLException * On any uncommon event that occurs while sending * data through the encrypted socket. */ void auth_plain (const string &username, const string &password); /** * Authenticates the user using the CRAM-MD5 method. * * @param username The username that should be used for authentication. * @param passwd The password that should be used for authentication. * * @throws TransferException * If the SMTP server responds with an error msg. * @throws TransferException * On any uncommon event that occurs while sending * data through the socket. * @throws SSLException * On any uncommon event that occurs while sending * data through the encrypted socket. * @throws DecodeException * If the BASE64 data was invalid. */ void auth_cram_md5 (const string &username, const string &password); /** * authenticates the user using the CRAM-SHA1 method. * * @param username The username that should be used for authentication. * @param passwd The password that should be used for authentication. * * @throws TransferException * If the SMTP server responds with an error msg. * @throws TransferException * On any uncommon event that occurs while sending * data through the socket. * @throws SSLException * On any uncommon event that occurs while sending * data through the encrypted socket. * @throws DecodeException * If the BASE64 data was invalid. */ void auth_cram_sha1 (const string &username, const string &password); /** * Reads the response from the smtp server. * * @param is_221_fatal If true a SMTP response with the ID 221 will * result in a TransferException. * * @throws TransferException * If the SMTP server responds with an error msg. * @throws TransferException * On any uncommon event that occurs while receiving * data from the socket. * @throws SSLException * On any uncommon event that occurs while receiving * data from the encrypted socket. */ string read_response (bool is_221_fatal = true); /** * Check if the given authentication method is supported by the * server. If not an AuthenticationfailedException is thrown. * * @param response The string that the SMTP server send as a response * to the EHLO cmd. * @param auth_type The authentication mechanism that is to be checked. * * @throws AuthenticationFailedException * If the given authentication method is not * supported by the SMTP server. */ void check_auth_method (const string &response, const string &auth_type); /** * determine the best authentication mechanism supported by * the SMTP server. * * @param response The string that the SMTP server send as a response * to the EHLO cmd. */ AUTH_TYPE best_auth_method (const string &response);};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -