105 |
Mail_T m; |
Mail_T m; |
106 |
SendMail_T S; |
SendMail_T S; |
107 |
char now[STRLEN]; |
char now[STRLEN]; |
108 |
int rv = TRUE; |
int rv = FALSE; |
109 |
|
|
110 |
ASSERT(mail); |
ASSERT(mail); |
111 |
|
|
112 |
if(sigsetjmp(S.error, TRUE)) { |
if(sigsetjmp(S.error, TRUE)) { |
|
rv = FALSE; |
|
113 |
goto exit; |
goto exit; |
114 |
} |
} |
115 |
open_server(&S); |
open_server(&S); |
117 |
if(gethostname(S.localhost, sizeof(S.localhost)) < 0) { |
if(gethostname(S.localhost, sizeof(S.localhost)) < 0) { |
118 |
snprintf(S.localhost, sizeof(S.localhost), "%s", LOCALHOST); |
snprintf(S.localhost, sizeof(S.localhost), "%s", LOCALHOST); |
119 |
} |
} |
|
/* |
|
|
* FIXME: Implement this as a small state machine and handle server |
|
|
* returned status codes as transition points. |
|
|
*/ |
|
120 |
do_status(&S); |
do_status(&S); |
121 |
do_send(&S, "HELO %s\r\n", S.localhost); |
do_send(&S, "HELO %s\r\n", S.localhost); |
122 |
do_status(&S); |
do_status(&S); |
144 |
do_status(&S); |
do_status(&S); |
145 |
} |
} |
146 |
do_send(&S, "QUIT\r\n"); |
do_send(&S, "QUIT\r\n"); |
147 |
|
rv = TRUE; |
148 |
exit: |
exit: |
149 |
if(S.socket) { |
if(S.socket) { |
150 |
socket_free(&S.socket); |
socket_free(&S.socket); |