2
* This file is part of libESMTP, a library for submission of RFC 2822
3
* formatted electronic mail messages using the SMTP protocol described
6
* Copyright (C) 2001,2002 Brian Stafford <brian@stafford.uklinux.net>
8
* This library is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Lesser General Public
10
* License as published by the Free Software Foundation; either
11
* version 2.1 of the License, or (at your option) any later version.
13
* This library is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* Lesser General Public License for more details.
18
* You should have received a copy of the GNU Lesser General Public
19
* License along with this library; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
/* Standard callback functions for use by message-source.c
24
An application requiring anything more sophisticated than either of
25
these will need to supply its own callback. */
35
/* Callback function to read the message from a file. The file MUST be
36
formatted according to RFC 2822 and lines MUST be terminated with the
37
canonical CRLF sequence. Furthermore, RFC 2821 line length
38
limitations must be observed (1000 octets maximum). */
42
_smtp_message_fp_cb (void **ctx, int *len, void *arg)
45
*ctx = malloc (BUFLEN);
49
rewind ((FILE *) arg);
53
*len = fread (*ctx, 1, BUFLEN, (FILE *) arg);
64
_smtp_message_str_cb (void **ctx, int *len, void *arg)
66
const char *string = arg;
70
*ctx = malloc (sizeof (struct state));
76
state->length = strlen (string);