3 /***************************************************************************
5 * Project ___| | | | _ \| |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 2009 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at http://curl.haxx.se/docs/copyright.html.
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 ***************************************************************************/
27 /****************************************************************************
29 ***************************************************************************/
31 SMTP_STOP, /* do nothing state, stops the state machine */
32 SMTP_SERVERGREET, /* waiting for the initial greeting immediately after
37 SMTP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS
44 SMTP_AUTHNTLM_TYPE2MSG,
46 SMTP_MAIL, /* MAIL FROM */
47 SMTP_RCPT, /* RCPT TO */
51 SMTP_LAST /* never used */
54 /* smtp_conn is used for struct connection-oriented data in the connectdata
58 char *domain; /* what to send in the EHLO */
59 size_t eob; /* number of bytes of the EOB (End Of Body) that has been
61 unsigned int authmechs; /* Accepted authentication methods. */
62 unsigned int authused; /* Authentication method used for the connection */
63 smtpstate state; /* always use smtp.c:state() to change state! */
64 struct curl_slist *rcpt;
65 bool ssldone; /* is connect() over SSL done? only relevant in multi mode */
68 /* Authentication mechanism flags. */
69 #define SMTP_AUTH_LOGIN 0x0001
70 #define SMTP_AUTH_PLAIN 0x0002
71 #define SMTP_AUTH_CRAM_MD5 0x0004
72 #define SMTP_AUTH_DIGEST_MD5 0x0008
73 #define SMTP_AUTH_GSSAPI 0x0010
74 #define SMTP_AUTH_EXTERNAL 0x0020
75 #define SMTP_AUTH_NTLM 0x0040
77 extern const struct Curl_handler Curl_handler_smtp;
78 extern const struct Curl_handler Curl_handler_smtps;
80 /* this is the 5-bytes End-Of-Body marker for SMTP */
81 #define SMTP_EOB "\x0d\x0a\x2e\x0d\x0a"
82 #define SMTP_EOB_LEN 5
84 /* if found in data, replace it with this string instead */
85 #define SMTP_EOB_REPL "\x0d\x0a\x2e\x2e"
86 #define SMTP_EOB_REPL_LEN 4
88 CURLcode Curl_smtp_escape_eob(struct connectdata *conn, ssize_t nread);