Re: Sending mail from Apache Module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The error log is rather odd and is coming with a debugging output I add myself only:

[Sat Jul 31 10:13:29.824371 2021] [:debug] [pid 30273:tid 3027227680] src/mod_mini_booking.c(73): [client 81.169.144.135:34004] handleBooking(): smtp failed with Failed to authenticate with the given credentials, referer: <WEBSITE> 

The smtp-client code generating this is:

  		struct smtp *smtp;
  		smtp_status_code rc;

  		rc = smtp_open(<SMTPSERVER>", "465",
                 SMTP_SECURITY_TLS, SMTP_NO_CERT_VERIFY, NULL, &smtp);
  		rc = smtp_auth(smtp, SMTP_AUTH_LOGIN, <EMAIL>, <PASSWORD>);
		rc = smtp_address_add(smtp, SMTP_ADDRESS_FROM, <EMAIL>, <WEBSITENAME>);
		rc = smtp_address_add(smtp, SMTP_ADDRESS_TO, form("email"), form("name"));
		rc = smtp_header_add(smtp, "Subject", "Buchungsbestätigung");
		rc = smtp_mail(smtp, "BODY");
		rc = smtp_close(smtp);

       		if (rc==SMTP_STATUS_OK)
        		debug("handleBooking(): sent mail successfully");
        	else
    			debug("handleBooking(): smtp failed with %s", smtp_status_code_errstr(rc)); 

With <WEBSITE>, <SMTPSERVER>, <EMAIL>, <PASSWORD>, <WEBSITENAME> added for privacy reasons.
The sequence fails when calling smtp_auth(), rc is carried on by this library.

The smtp library sends debugging output to stderr. This would be interesting to see. Any idea where stderr is forwarded to by apache?


> On 31. Jul 2021, at 11:55, Antony Stone <Antony.Stone@xxxxxxxxxxxxxxxxxxxxx> wrote:
> 
> On Saturday 31 July 2021 at 11:46:50, Harald Schlangmann wrote:
> 
>> First post to this group, so please forgive anything I'm doing wrong.
> 
> Welcome.
> 
>> Problem: everything is going fine except for sending a confirmation mail to
>> users once a booking has been successful. I use
>> https://github.com/somnisoft/smtp-client as a simple C based SMTP client
>> embedded into the module. While the function to send a mail is working
>> fine when compiling it as a separate C program and running it from the
>> command line, it fails when embedding  the function into my Apache module.
> 
> Show us details of what "fails" means.
> 
> Minimum: what shows up in Apache's log files when the email is supposed to be 
> sent.
> 
> Maybe helpful: a packet capture (using something like tcpdump or tshark) of 
> any communication with the remote mail server.
> 
> Also "For SMTP, port 465 and TLS security (openssl) is used."
> 
> Try starting simple and eliminate the TLS - just send SMTP to some mail server 
> on port 25.  If that works, we know it's not the module per se, and we can 
> focus on the SSL library.
> 
> 
> Antony.
> 
> -- 
> People say that nothing is impossible, so I try to do the impossible every 
> day.
> 
>                                                   Please reply to the list;
>                                                         please *don't* CC me.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx





[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux