Question

How do I specify smtp host on log4php I will be using it with gmail using the following configurations.

smtp.gmail.com (use authentication)
Use Authentication: Yes
Port for TLS/STARTTLS: 587
Port for SSL: 465
Was it helpful?

Solution

You don't say what OS this relates to - On a Microsoft platform. log4php uses PHP's mail command - but this is implemented differently on Microsoft (SMTP TCP client) compared with every other operating system (uses local binary program via stdio).

The simplest way around this would be to modify the LoggerAppenderMail to use phpmailer or swift mailer in place of the php mail() command.

But if you'd rather not tinker with the standard libs and have to maintain your own patchset, then you should set up a local MTA which can smart relay via SSL with authentication e.g. ssmtp or msmtp. Of course you can use a full blown MTA like postfix or sendmail if you really want.

OTHER TIPS

You just need to follow the instructions in the Appender documentation for log4php available here.

What you need would be the following appender types:

LoggerAppenderMail
LoggerAppenderMailEvent
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top