masqmail
view src/smtp_out.h @ 5:3cafdebd1479
removed remaining reference to docs in Makefile
author | meillo@marmaro.de |
---|---|
date | Fri, 26 Sep 2008 22:15:26 +0200 |
parents | |
children | 26e34ae9a3e3 |
line source
1 /* smtp_out.h, Copyright (C) Oliver Kurth,
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
18 #include <unistd.h>
19 #include <sys/types.h>
20 #include <sys/socket.h>
21 #include <sys/time.h>
22 #include <netinet/in.h>
23 #include <netdb.h>
25 #define SMTP_BUF_LEN 1024
26 #define SMTP_SIZE_ADD 1024
28 #define SMTP_INITIAL_TIMEOUT 5*60
29 #define SMTP_CMD_TIMEOUT 5*60
30 #define SMTP_DATA_TIMEOUT 5*60
31 #define SMTP_FINAL_TIMEOUT 10*60
33 typedef
34 enum _smtp_error{
35 smtp_ok = 0, /* mail was delivered to at least one recpient */
36 smtp_trylater, /* server responded with 4xx */
37 smtp_fail, /* server responded with 5xx */
38 smtp_timeout, /* connection timed out */
39 smtp_eof, /* got unexpected EOF */
40 smtp_syntax, /* unexpected response */
41 smtp_cancel /* we gave up (eg. size) */
42 } smtp_error;
45 typedef
46 struct _smtp_base{
47 FILE *in;
48 FILE *out;
50 gint sock;
51 gint dup_sock;
53 gchar *remote_host;
54 gchar *helo_name;
56 gchar *buffer;
57 gint last_code;
59 gboolean use_esmtp;
60 gboolean use_size;
61 gboolean use_pipelining;
62 gboolean use_auth;
64 gint max_size;
66 gchar **auth_names;
68 gchar *auth_name;
69 gchar *auth_login;
70 gchar *auth_secret;
72 smtp_error error;
74 } smtp_base;
76 gchar *set_heloname(smtp_base *psb, gchar *default_name, gboolean do_correct);
77 gboolean set_auth(smtp_base *psb, gchar *name, gchar *login, gchar *secret);
78 void destroy_smtpbase(smtp_base *psb);
79 smtp_base *smtp_out_open(gchar *host, gint port, GList *resolve_list);
80 smtp_base *smtp_out_open_child(gchar *cmd);
81 gboolean smtp_out_rset(smtp_base *psb);
82 gboolean smtp_out_init(smtp_base *psb);
83 gint smtp_out_msg(smtp_base *psb,
84 message *msg, address *return_path,
85 GList *rcpt_list, GList *hdr_list);
86 gboolean smtp_out_quit(smtp_base *psb);
88 gint smtp_deliver(gchar *host, gint port, GList *resolve_list,
89 message *msg,
90 address *return_path,
91 GList *rcpt_list);