]>
Commit | Line | Data |
---|---|---|
9295cbf4 MW |
1 | diff -urN mutt-1.4.1.org/configure.in mutt-1.4.1/configure.in |
2 | --- mutt-1.4.1.org/configure.in 2003-08-21 15:30:19.000000000 +0200 | |
3 | +++ mutt-1.4.1/configure.in 2003-08-21 15:31:08.962016232 +0200 | |
4 | @@ -869,6 +869,19 @@ | |
5 | AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,[ Define if you have <langinfo.h> and nl_langinfo(YESEXPR). ]) | |
6 | fi | |
7 | ||
8 | +dnl -- libesmtp -- | |
9 | +MUTT_AM_LIBESMTP | |
10 | +if test x$use_libesmtp = xyes; then | |
11 | + CFLAGS="$CFLAGS $mutt_libesmtp_cflags" | |
12 | + MUTTLIBS="$MUTTLIBS $mutt_libesmtp_libs" | |
13 | + MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_libesmtp.o -lpthread" | |
14 | + | |
15 | + AC_DEFINE(USE_LIBESMTP, | |
16 | + 1, | |
17 | + [Define to enable the use of libesmtp]) | |
18 | +fi | |
19 | +dnl -- end libesmtp -- | |
20 | + | |
21 | AC_OUTPUT(Makefile intl/Makefile m4/Makefile | |
22 | po/Makefile.in doc/Makefile contrib/Makefile | |
23 | muttbug.sh | |
24 | diff -urN mutt-1.4.1.org/globals.h mutt-1.4.1/globals.h | |
25 | --- mutt-1.4.1.org/globals.h 2003-08-21 15:30:19.000000000 +0200 | |
26 | +++ mutt-1.4.1/globals.h 2003-08-21 15:31:08.964015928 +0200 | |
27 | @@ -103,6 +103,12 @@ | |
28 | WHERE char *Signature; | |
29 | WHERE char *SigDirectory; | |
30 | WHERE char *SimpleSearch; | |
31 | +#if defined(USE_LIBESMTP) | |
32 | +WHERE char *SmtpAuthUser; | |
33 | +WHERE char *SmtpAuthPass; | |
34 | +WHERE char *SmtpHost; | |
35 | +WHERE unsigned short SmtpPort; | |
36 | +#endif | |
37 | WHERE char *Spoolfile; | |
38 | #if defined(USE_SSL) || defined(USE_NSS) | |
39 | WHERE char *SslCertFile INITVAL (NULL); | |
40 | diff -urN mutt-1.4.1.org/init.h mutt-1.4.1/init.h | |
41 | --- mutt-1.4.1.org/init.h 2003-08-21 15:30:19.000000000 +0200 | |
42 | +++ mutt-1.4.1/init.h 2003-08-21 15:31:08.976014104 +0200 | |
43 | @@ -99,6 +99,9 @@ | |
44 | # ifndef USE_SOCKET | |
45 | # define USE_SOCKET | |
46 | # endif | |
47 | +# ifndef USE_LIBESMTP | |
48 | +# define USE_LIBESMTP | |
49 | +# endif | |
50 | #endif | |
51 | ||
52 | struct option_t MuttVars[] = { | |
53 | @@ -1468,6 +1471,38 @@ | |
54 | /* | |
55 | */ | |
56 | #endif /* HAVE_PGP */ | |
57 | + | |
58 | +#if defined(USE_LIBESMTP) | |
59 | + { "smtp_auth_username", DT_STR, R_NONE, UL &SmtpAuthUser, 0 }, | |
60 | + /* | |
61 | + ** .pp | |
62 | + ** Defines the username to use with SMTP AUTH. Setting this variable will | |
63 | + ** cause mutt to attempt to use SMTP AUTH when sending. | |
64 | + */ | |
65 | + { "smtp_auth_password", DT_STR, R_NONE, UL &SmtpAuthPass, 0 }, | |
66 | + /* | |
67 | + ** .pp | |
68 | + ** Defines the password to use with SMTP AUTH. If ``$$smtp_auth_username'' | |
69 | + ** is set, but this variable is not, you will be prompted for a password | |
70 | + ** when sending. | |
71 | + */ | |
72 | + { "smtp_host", DT_STR, R_NONE, UL &SmtpHost, 0 }, | |
73 | + /* | |
74 | + ** .pp | |
75 | + ** Defines the SMTP host which will be used to deliver mail, as opposed | |
76 | + ** to invoking the sendmail binary. Setting this variable overrides the | |
77 | + ** value of ``$$sendmail'', and any associated variables. | |
78 | + */ | |
79 | + { "smtp_port", DT_NUM, R_NONE, UL &SmtpPort, 25 }, | |
80 | + /* | |
81 | + ** .pp | |
82 | + ** Defines the port that the SMTP host is listening on for mail delivery. | |
83 | + ** Must be specified as a number. | |
84 | + ** .pp | |
85 | + ** Defaults to 25, the standard SMTP port, but RFC 2476-compliant SMTP | |
86 | + ** servers will probably desire 587, the mail submission port. | |
87 | + */ | |
88 | +#endif | |
89 | ||
90 | #if defined(USE_SSL)||defined(USE_NSS) | |
91 | # ifndef USE_NSS | |
92 | diff -urN mutt-1.4.1.org/m4/libesmtp.m4 mutt-1.4.1/m4/libesmtp.m4 | |
93 | --- mutt-1.4.1.org/m4/libesmtp.m4 1970-01-01 01:00:00.000000000 +0100 | |
94 | +++ mutt-1.4.1/m4/libesmtp.m4 2003-08-21 15:31:08.978013800 +0200 | |
95 | @@ -0,0 +1,60 @@ | |
96 | +dnl vim:ft=config: | |
97 | + | |
98 | +dnl Search for libesmtp, by Steven Engelhardt <sengelha@yahoo.com> | |
99 | +dnl | |
100 | +dnl libesmtp often requires linking against -lpthread or -lc_r (BSD). | |
101 | +dnl This macro attempts to centralize this code. | |
102 | + | |
103 | +AC_DEFUN([MUTT_AM_LIBESMTP], | |
104 | +[ | |
105 | + AC_ARG_WITH( | |
106 | + [libesmtp], | |
107 | + [ --with-libesmtp=DIR Compile in support for libesmtp for the MTA], | |
108 | + [ if test "$with_libesmtp" != "no" | |
109 | + then | |
110 | + mutt_libesmtp_check_path="$PATH" | |
111 | + | |
112 | + if test "$with_libesmtp" != "yes" | |
113 | + then | |
114 | + mutt_libesmtp_check_path="$tmp_path:$withval/bin" | |
115 | + fi | |
116 | + | |
117 | + dnl 1. Find libesmtp-config | |
118 | + mutt_libesmtp_config_path=`which libesmtp-config || echo no` | |
119 | + | |
120 | + if test "$mutt_libesmtp_config_path" = "no" | |
121 | + then | |
122 | + AC_MSG_ERROR([libesmtp-config binary not found.]) | |
123 | + fi | |
124 | + | |
125 | + dnl 2. Get CFLAGS and LIBS from libesmtp-config | |
126 | + mutt_libesmtp_cflags=`$mutt_libesmtp_config_path --cflags` | |
127 | + mutt_libesmtp_libs=`$mutt_libesmtp_config_path --libs` | |
128 | + | |
129 | + dnl 3. Verify libesmtp.h can be found with these settings | |
130 | + temp_CFLAGS="$CFLAGS" | |
131 | + CFLAGS="$CFLAGS $mutt_libesmtp_cflags" | |
132 | + AC_CHECK_HEADER([libesmtp.h], | |
133 | + [], | |
134 | + AC_MSG_ERROR([Could not find libesmtp.h])) | |
135 | + CFLAGS="$temp_CFLAGS" | |
136 | + | |
137 | + dnl 4. Verify the libesmtp library can be linked in | |
138 | + temp_CFLAGS="$CFLAGS" | |
139 | + temp_LIBS="$LIBS" | |
140 | + CFLAGS="$CFLAGS $mutt_libesmtp_cflags" | |
141 | + LIBS="$LIBS $mutt_libesmtp_libs" | |
142 | + AC_CHECK_LIB([esmtp], | |
143 | + [smtp_create_session], | |
144 | + [], | |
145 | + AC_MSG_ERROR([Could not find libesmtp])) | |
146 | + CFLAGS="$temp_CFLAGS" | |
147 | + LIBS="$temp_LIBS" | |
148 | + | |
149 | + dnl 5. Export use_libesmtp variable so configure.in can | |
150 | + dnl act accordingly. | |
151 | + use_libesmtp=yes | |
152 | + fi | |
153 | + ] | |
154 | + ) | |
155 | +]) | |
156 | diff -urN mutt-1.4.1.org/main.c mutt-1.4.1/main.c | |
157 | --- mutt-1.4.1.org/main.c 2003-08-21 15:30:19.000000000 +0200 | |
158 | +++ mutt-1.4.1/main.c 2003-08-21 15:31:08.982013192 +0200 | |
159 | @@ -226,6 +226,12 @@ | |
160 | #else | |
161 | "-USE_SASL " | |
162 | #endif | |
163 | + | |
164 | +#ifdef USE_LIBESMTP | |
165 | + "+USE_LIBESMTP " | |
166 | +#else | |
167 | + "-USE_LIBESMTP " | |
168 | +#endif | |
169 | "\n" | |
170 | ||
171 | #ifdef HAVE_REGCOMP | |
172 | diff -urN mutt-1.4.1.org/Makefile.am mutt-1.4.1/Makefile.am | |
173 | --- mutt-1.4.1.org/Makefile.am 2003-08-21 15:30:18.000000000 +0200 | |
174 | +++ mutt-1.4.1/Makefile.am 2003-08-21 15:31:08.984012888 +0200 | |
175 | @@ -68,7 +68,8 @@ | |
176 | EXTRA_mutt_SOURCES = account.c md5c.c mutt_sasl.c mutt_socket.c mutt_ssl.c \ | |
177 | mutt_tunnel.c pop.c pop_auth.c pop_lib.c pgp.c pgpinvoke.c pgpkey.c \ | |
178 | pgplib.c sha1.c pgpmicalg.c gnupgparse.c resize.c dotlock.c remailer.c \ | |
179 | - browser.h mbyte.h remailer.h url.h mutt_ssl_nss.c pgppacket.c | |
180 | + browser.h mbyte.h remailer.h url.h mutt_ssl_nss.c pgppacket.c \ | |
181 | + mutt_libesmtp.c | |
182 | ||
183 | EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP TODO configure acconfig.h account.h \ | |
184 | attach.h buffy.h charset.h compress.h copy.h dotlock.h functions.h \ | |
185 | @@ -80,7 +81,8 @@ | |
186 | _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \ | |
187 | mbyte.h lib.h extlib.c pgpewrap.c pgplib.h Muttrc.head Muttrc \ | |
188 | makedoc.c stamp-doc-rc README.SSL \ | |
189 | - muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh | |
190 | + muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \ | |
191 | + mutt_libesmtp.h | |
192 | ||
193 | mutt_dotlock_SOURCES = mutt_dotlock.c | |
194 | mutt_dotlock_LDADD = @LIBOBJS@ | |
195 | diff -urN mutt-1.4.1.org/mutt_libesmtp.c mutt-1.4.1/mutt_libesmtp.c | |
196 | --- mutt-1.4.1.org/mutt_libesmtp.c 1970-01-01 01:00:00.000000000 +0100 | |
197 | +++ mutt-1.4.1/mutt_libesmtp.c 2003-08-21 15:31:08.987012432 +0200 | |
198 | @@ -0,0 +1,224 @@ | |
199 | +#include "mutt.h" | |
200 | +#include <auth-client.h> | |
201 | +#include <libesmtp.h> | |
202 | +#include <errno.h> | |
203 | + | |
204 | +static char authpass[STRING] = ""; | |
205 | + | |
206 | +#define FAIL() \ | |
207 | + do { \ | |
208 | + ret = -1; \ | |
209 | + goto Done; \ | |
210 | + } while (0) | |
211 | +#define MSGFAIL(msg) \ | |
212 | + do { \ | |
213 | + mutt_error("%s", msg); \ | |
214 | + FAIL(); \ | |
215 | + } while (0) | |
216 | +#define LIBCFAIL(msg) \ | |
217 | + do { \ | |
218 | + mutt_error("%s: %s", msg, strerror(errno)); \ | |
219 | + FAIL(); \ | |
220 | + } while (0) | |
221 | +#define SMTPFAIL(msg) \ | |
222 | + do { \ | |
223 | + _mutt_libesmtp_perror(msg); \ | |
224 | + FAIL(); \ | |
225 | + } while (0) | |
226 | + | |
227 | +/* | |
228 | + * _mutt_libesmtp_ensure_init | |
229 | + * Make sure the libESMTP support in mutt is initialized at some time. | |
230 | + */ | |
231 | +static void | |
232 | +_mutt_libesmtp_ensure_init() | |
233 | +{ | |
234 | + static int libesmtp_init = 0; | |
235 | + | |
236 | + if (!libesmtp_init) { | |
237 | + if (SmtpAuthUser) | |
238 | + auth_client_init(); | |
239 | + libesmtp_init = 1; | |
240 | + } | |
241 | +} | |
242 | + | |
243 | +/* | |
244 | + * _mutt_libesmtp_perror | |
245 | + * Prints 'msg', a colon, and then a string representation of the | |
246 | + * libesmtp errno as a mutt error. | |
247 | + */ | |
248 | +static void | |
249 | +_mutt_libesmtp_perror(const char* msg) | |
250 | +{ | |
251 | + char buf[512]; | |
252 | + | |
253 | + mutt_error("%s: %s", msg, smtp_strerror(smtp_errno(), buf, sizeof(buf))); | |
254 | +} | |
255 | + | |
256 | +/* | |
257 | + * _mutt_libesmtp_add_recipients | |
258 | + * Adds every address in 'addr' as a recipient to the smtp message | |
259 | + * 'message'. Note that this does not mean that they will necessarily | |
260 | + * show up in the mail headers (e.g., when bcc'ing). Returns 0 upon | |
261 | + * success, -1 upon failure (and prints an error message). | |
262 | + * | |
263 | + * Very similar to sendlib.c::add_args | |
264 | + */ | |
265 | +static int | |
266 | +_mutt_libesmtp_add_recipients(smtp_message_t message, ADDRESS *addr) | |
267 | +{ | |
268 | + int ret = 0; | |
269 | + | |
270 | + for (; addr; addr = addr->next) { | |
271 | + /* weed out group mailboxes, since those are for display only */ | |
272 | + if (addr->mailbox && !addr->group) { | |
273 | + if (!smtp_add_recipient(message, addr->mailbox)) | |
274 | + SMTPFAIL("smtp_add_recipient"); | |
275 | + } | |
276 | + } | |
277 | + | |
278 | +Done: | |
279 | + return ret; | |
280 | +} | |
281 | + | |
282 | +static int | |
283 | +_mutt_libesmtp_auth_interact(auth_client_request_t request, | |
284 | + char **result, int fields, void *arg) | |
285 | +{ | |
286 | + int i; | |
287 | + | |
288 | + for (i = 0; i < fields; i++) { | |
289 | + if (request[i].flags & AUTH_USER) { | |
290 | + result[i] = SmtpAuthUser; | |
291 | + } else if (request[i].flags & AUTH_PASS) { | |
292 | + if (SmtpAuthPass) { | |
293 | + result[i] = SmtpAuthPass; | |
294 | + } else { | |
295 | + if (authpass[0] == '\0') { | |
296 | + char prompt[STRING]; | |
297 | + | |
298 | + snprintf(prompt, sizeof(prompt), "%s%s: ", request[i].prompt, | |
299 | + (request[i].flags & AUTH_CLEARTEXT) ? " (not encrypted)" : ""); | |
300 | + mutt_get_password(prompt, authpass, sizeof(authpass)); | |
301 | + } | |
302 | + result[i] = authpass; | |
303 | + } | |
304 | + } | |
305 | + } | |
306 | + | |
307 | + return 1; | |
308 | +} | |
309 | + | |
310 | +#define BUFLEN 8192 | |
311 | + | |
312 | +static const char* | |
313 | +_mutt_libesmtp_messagefp_cb(void **buf, int *len, void *arg) | |
314 | +{ | |
315 | + int octets; | |
316 | + | |
317 | + if (*buf == NULL) | |
318 | + *buf = malloc(BUFLEN); | |
319 | + | |
320 | + if (len == NULL) { | |
321 | + rewind((FILE*) arg); | |
322 | + return NULL; | |
323 | + } | |
324 | + | |
325 | + if (fgets(*buf, BUFLEN - 2, (FILE*) arg) == NULL) { | |
326 | + octets = 0; | |
327 | + } else { | |
328 | + char* p = strchr(*buf, '\0'); | |
329 | + | |
330 | + if (p[-1] == '\n' && p[-2] != '\r') { | |
331 | + strcpy(p - 1, "\r\n"); | |
332 | + p++; | |
333 | + } | |
334 | + octets = p - (char*) *buf; | |
335 | + } | |
336 | + | |
337 | + *len = octets; | |
338 | + return *buf; | |
339 | +} | |
340 | + | |
341 | +/* | |
342 | + * mutt_invoke_libesmtp | |
343 | + * Sends a mail message to the provided recipients using libesmtp. | |
344 | + * Returns 0 upon success, -1 upon failure (and prints an error | |
345 | + * message). | |
346 | + */ | |
347 | +int | |
348 | +mutt_invoke_libesmtp(ADDRESS *from, /* the sender */ | |
349 | + ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */ | |
350 | + const char *msg, /* file containing message */ | |
351 | + int eightbit) /* message contains 8bit chars */ | |
352 | +{ | |
353 | + int ret = 0; /* return value, default = success */ | |
354 | + smtp_session_t session; | |
355 | + smtp_message_t message; | |
356 | + char* hostportstr = NULL; | |
357 | + size_t hostportlen; | |
358 | + FILE* fp = NULL; | |
359 | + auth_context_t authctx = NULL; | |
360 | + const smtp_status_t* status; | |
361 | + | |
362 | + _mutt_libesmtp_ensure_init(); | |
363 | + | |
364 | + if ((session = smtp_create_session()) == NULL) | |
365 | + SMTPFAIL("smtp_create_session"); | |
366 | + if ((message = smtp_add_message(session)) == NULL) | |
367 | + SMTPFAIL("smtp_add_message"); | |
368 | + | |
369 | + /* Create hostname:port string and tell libesmtp */ | |
370 | + /* len = SmtpHost len + colon + max port (65536 => 5 chars) + terminator */ | |
371 | + hostportlen = strlen(SmtpHost) + 7; | |
372 | + hostportstr = safe_malloc(hostportlen); | |
373 | + snprintf(hostportstr, hostportlen, "%s:%d", SmtpHost, SmtpPort); | |
374 | + if (!smtp_set_server(session, hostportstr)) | |
375 | + SMTPFAIL("smtp_set_server"); | |
376 | + | |
377 | + if (SmtpAuthUser) { | |
378 | + if ((authctx = auth_create_context()) == NULL) | |
379 | + MSGFAIL("auth_create_context failed"); | |
380 | + auth_set_mechanism_flags(authctx, AUTH_PLUGIN_PLAIN, 0); | |
381 | + auth_set_interact_cb(authctx, _mutt_libesmtp_auth_interact, NULL); | |
382 | + | |
383 | + if (!smtp_auth_set_context(session, authctx)) | |
384 | + SMTPFAIL("smtp_auth_set_context"); | |
385 | + } | |
386 | + | |
387 | + if ((fp = fopen(msg, "r")) == NULL) | |
388 | + LIBCFAIL("fopen"); | |
389 | + if (!smtp_set_messagecb(message, _mutt_libesmtp_messagefp_cb, fp)) | |
390 | + SMTPFAIL("smtp_set_messagecb"); | |
391 | + if (_mutt_libesmtp_add_recipients(message, to)) | |
392 | + FAIL(); | |
393 | + if (_mutt_libesmtp_add_recipients(message, cc)) | |
394 | + FAIL(); | |
395 | + if (_mutt_libesmtp_add_recipients(message, bcc)) | |
396 | + FAIL(); | |
397 | + if (!smtp_start_session(session)) | |
398 | + SMTPFAIL("smtp_start_session"); | |
399 | + | |
400 | + status = smtp_message_transfer_status(message); | |
401 | + if (status->code < 200 || status->code > 299) { | |
402 | + char buf[256]; | |
403 | + snprintf(buf, sizeof(buf), "SMTP error while sending: %d %s", status->code, status->text); | |
404 | + MSGFAIL(buf); | |
405 | + } | |
406 | + | |
407 | +Done: | |
408 | + if (fp != NULL) | |
409 | + fclose(fp); | |
410 | + if (hostportstr != NULL) | |
411 | + free(hostportstr); | |
412 | + if (session != NULL) | |
413 | + smtp_destroy_session(session); | |
414 | + if (authctx != NULL) | |
415 | + auth_destroy_context(authctx); | |
416 | + | |
417 | + /* Forget user-entered SMTP AUTH password if send fails */ | |
418 | + if (ret != 0) | |
419 | + authpass[0] = '\0'; | |
420 | + | |
421 | + return ret; | |
422 | +} | |
423 | diff -urN mutt-1.4.1.org/mutt_libesmtp.h mutt-1.4.1/mutt_libesmtp.h | |
424 | --- mutt-1.4.1.org/mutt_libesmtp.h 1970-01-01 01:00:00.000000000 +0100 | |
425 | +++ mutt-1.4.1/mutt_libesmtp.h 2003-08-21 15:31:08.988012280 +0200 | |
426 | @@ -0,0 +1,10 @@ | |
427 | +#if !defined(LIBESMTP_H) | |
428 | +#define LIBESMTP_H | |
429 | + | |
430 | +int | |
431 | +mutt_invoke_libesmtp (ADDRESS *from, /* the sender */ | |
432 | + ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */ | |
433 | + const char *msg, /* file containing message */ | |
434 | + int eightbit); /* message contains 8bit chars */ | |
435 | + | |
436 | +#endif /* !defined(LIBESMTP_H) */ | |
437 | diff -urN mutt-1.4.1.org/Muttrc.esmtp mutt-1.4.1/Muttrc.esmtp | |
438 | --- mutt-1.4.1.org/Muttrc.esmtp 1970-01-01 01:00:00.000000000 +0100 | |
439 | +++ mutt-1.4.1/Muttrc.esmtp 2003-08-21 14:57:35.000000000 +0200 | |
440 | @@ -0,0 +1,20 @@ | |
441 | +# enable minimalistic smtp support builtin to Mutt | |
442 | +set sendmail = "builtin" | |
443 | + | |
444 | +# The name or address of your SMTP server. | |
445 | +set smtp_serv = "fastmail.fm" | |
446 | + | |
447 | +# Your login name on the SMTP server. Mutt presents you | |
448 | +# as ``smtp_user''@``smtp_host'', unless ``envelope_from'' | |
449 | +# is set, this will then be the message's envelope sender. | |
450 | +# Defaults to your login name on the local system. | |
451 | +set smtp_user = "ulferikson" | |
452 | + | |
453 | +# If set, Mutt will try to use ESMPT and ``AUTH LOGIN'' to | |
454 | +# authenticate your user. | |
455 | +set smtp_pass = "" | |
456 | + | |
457 | +# This variable specifies which port your SMTP server is | |
458 | +# listening on. | |
459 | +set smtp_port = 25 | |
460 | + | |
461 | diff -urN mutt-1.4.1.org/protos.h mutt-1.4.1/protos.h | |
462 | --- mutt-1.4.1.org/protos.h 2003-08-21 15:30:19.000000000 +0200 | |
463 | +++ mutt-1.4.1/protos.h 2003-08-21 15:31:08.991011824 +0200 | |
464 | @@ -276,7 +276,7 @@ | |
465 | int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **, char *, size_t); | |
466 | int mutt_get_tmp_attachment (BODY *); | |
467 | int mutt_index_menu (void); | |
468 | -int mutt_invoke_sendmail (ADDRESS *, ADDRESS *, ADDRESS *, ADDRESS *, const char *, int); | |
469 | +int mutt_invoke_mta (ADDRESS *, ADDRESS *, ADDRESS *, ADDRESS *, const char *, int); | |
470 | int mutt_is_autoview (BODY *, const char *); | |
471 | int mutt_is_mail_list (ADDRESS *); | |
472 | int mutt_is_message_type(int, const char *); | |
473 | diff -urN mutt-1.4.1.org/send.c mutt-1.4.1/send.c | |
474 | --- mutt-1.4.1.org/send.c 2002-01-30 23:50:59.000000000 +0100 | |
475 | +++ mutt-1.4.1/send.c 2003-08-21 15:31:08.996011064 +0200 | |
476 | @@ -974,7 +974,7 @@ | |
477 | return mix_send_message (msg->chain, tempfile); | |
478 | #endif | |
479 | ||
480 | - i = mutt_invoke_sendmail (msg->env->from, msg->env->to, msg->env->cc, | |
481 | + i = mutt_invoke_mta (msg->env->from, msg->env->to, msg->env->cc, | |
482 | msg->env->bcc, tempfile, (msg->content->encoding == ENC8BIT)); | |
483 | return (i); | |
484 | } | |
485 | diff -urN mutt-1.4.1.org/sendlib.c mutt-1.4.1/sendlib.c | |
486 | --- mutt-1.4.1.org/sendlib.c 2003-08-21 15:30:19.000000000 +0200 | |
487 | +++ mutt-1.4.1/sendlib.c 2003-08-21 15:31:09.003010000 +0200 | |
488 | @@ -119,6 +119,9 @@ | |
489 | #endif /* HAVE_PGP */ | |
490 | ||
491 | ||
492 | +#ifdef USE_LIBESMTP | |
493 | +# include "mutt_libesmtp.h" | |
494 | +#endif /* USE_LIBESMTP */ | |
495 | ||
496 | #define DISPOSITION(X) X==DISPATTACH?"attachment":"inline" | |
497 | ||
498 | @@ -1970,7 +1973,7 @@ | |
499 | } | |
500 | ||
501 | ||
502 | -int | |
503 | +static int | |
504 | mutt_invoke_sendmail (ADDRESS *from, /* the sender */ | |
505 | ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */ | |
506 | const char *msg, /* file containing message */ | |
507 | @@ -2066,6 +2069,20 @@ | |
508 | return (i); | |
509 | } | |
510 | ||
511 | +int | |
512 | +mutt_invoke_mta (ADDRESS *from, /* the sender */ | |
513 | + ADDRESS *to, ADDRESS *cc, ADDRESS *bcc, /* recips */ | |
514 | + const char *msg, /* file containing message */ | |
515 | + int eightbit) /* message contains 8bit chars */ | |
516 | +{ | |
517 | +#ifdef USE_LIBESMTP | |
518 | + if (SmtpHost) | |
519 | + return mutt_invoke_libesmtp(from, to, cc, bcc, msg, eightbit); | |
520 | +#endif | |
521 | + | |
522 | + return mutt_invoke_sendmail(from, to, cc, bcc, msg, eightbit); | |
523 | +} | |
524 | + | |
525 | /* appends string 'b' to string 'a', and returns the pointer to the new | |
526 | string. */ | |
527 | char *mutt_append_string (char *a, const char *b) | |
528 | @@ -2219,8 +2236,8 @@ | |
529 | mutt_copy_bytes (fp, f, h->content->length); | |
530 | fclose (f); | |
531 | ||
532 | - mutt_invoke_sendmail (env_from, to, NULL, NULL, tempfile, | |
533 | - h->content->encoding == ENC8BIT); | |
534 | + mutt_invoke_mta (env_from, to, NULL, NULL, tempfile, | |
535 | + h->content->encoding == ENC8BIT); | |
536 | } | |
537 | ||
538 | if (msg) |