| | @@ -645,11 +645,14 @@ |
| 645 | 645 | u32 smtpFlags = SMTP_DIRECT; |
| 646 | 646 | if( mFlags & ALERT_TRACE ) smtpFlags |= SMTP_TRACE_STDOUT; |
| 647 | 647 | blob_init(&p->out, 0, 0); |
| 648 | 648 | p->pSmtp = smtp_session_new(domain_of_addr(p->zFrom), zRelay, |
| 649 | 649 | smtpFlags, 0); |
| 650 | | - if( p->zDest[0]=='d' ){ |
| 650 | + if( p->pSmtp==0 || p->pSmtp->zErr ){ |
| 651 | + emailerError(p, "Could not start SMTP session: %s", |
| 652 | + p->pSmtp ? p->pSmtp->zErr : "reason unknown"); |
| 653 | + }else if( p->zDest[0]=='d' ){ |
| 651 | 654 | smtp_session_config(p->pSmtp, SMTP_TRACE_BLOB, &p->out); |
| 652 | 655 | } |
| 653 | 656 | smtp_client_startup(p->pSmtp); |
| 654 | 657 | } |
| 655 | 658 | } |
| | @@ -3501,14 +3504,20 @@ |
| 3501 | 3504 | } |
| 3502 | 3505 | alert_send(pSender, &hdr, &body, 0); |
| 3503 | 3506 | } |
| 3504 | 3507 | db_finalize(&q); |
| 3505 | 3508 | } |
| 3506 | | - if( bTest ){ |
| 3507 | | - /* If the URL is /announce/test2 instead of just /announce, then no |
| 3508 | | - ** email is actually sent. Instead, the text of the email that would |
| 3509 | | - ** have been sent is displayed in the result window. */ |
| 3509 | + if( bTest && blob_size(&pSender->out) ){ |
| 3510 | + /* If the URL is "/announce/test2" then no email is actually sent. |
| 3511 | + ** Instead, the text of the email that would have been sent is |
| 3512 | + ** displayed in the result window. |
| 3513 | + ** |
| 3514 | + ** If the URL is "/announce/test3" and the email-send-method is "relay" |
| 3515 | + ** then the announcement is sent as it normally would be, but a |
| 3516 | + ** transcript of the SMTP conversation with the MTA is shown here. |
| 3517 | + */ |
| 3518 | + blob_trim(&pSender->out); |
| 3510 | 3519 | @ <pre style='border: 2px solid blue; padding: 1ex;'> |
| 3511 | 3520 | @ %h(blob_str(&pSender->out)) |
| 3512 | 3521 | @ </pre> |
| 3513 | 3522 | blob_reset(&pSender->out); |
| 3514 | 3523 | } |
| | @@ -3558,12 +3567,13 @@ |
| 3558 | 3567 | @ </p> |
| 3559 | 3568 | }else if( P("submit")!=0 && cgi_csrf_safe(2) ){ |
| 3560 | 3569 | char *zErr = alert_send_announcement(); |
| 3561 | 3570 | style_header("Announcement Sent"); |
| 3562 | 3571 | if( zErr ){ |
| 3563 | | - @ <h1>Internal Error</h1> |
| 3564 | | - @ <p>The following error was reported by the system: |
| 3572 | + @ <h1>Error</h1> |
| 3573 | + @ <p>The following error was reported by the |
| 3574 | + @ announcement-sending subsystem: |
| 3565 | 3575 | @ <blockquote><pre> |
| 3566 | 3576 | @ %h(zErr) |
| 3567 | 3577 | @ </pre></blockquote> |
| 3568 | 3578 | }else{ |
| 3569 | 3579 | @ <p>The announcement has been sent. |
| 3570 | 3580 | |