WSO2 APIM-Analytics 2.6.0无法发送告警邮件求助
From the error logs you shared (Error on 'APIM_ALERT_EMAIL_NOTIFICATION'. Dropping event at Sink 'email' as its still trying to reconnect!), the core issue is that the email sink cannot establish a connection to your SMTP server. Let's walk through the key checks and fixes you might have missed:
1. Complete the Analytics Worker Email Sink Configuration
You configured basic credentials in <API-M_ANALYTICS_HOME>/conf/worker/deployment.yaml, but missed critical SMTP server parameters. The APIM Analytics email sink doesn't inherit settings from APIM's output-event-adapters.xml—you need to define all SMTP details directly in the sink extension:
siddhi: extensions: ... - extension: name: email namespace: sink properties: username: abcd@163.com address: abcd@163.com password: YOUR_163_AUTH_CODE # Use the SMTP authorization code, not your login password host: smtp.163.com port: 465 # 163's SSL port (25 is often blocked by ISPs/firewalls) enableSsl: true auth: true ...
Note: For 163 mailboxes, you must generate an SMTP authorization code (in mailbox settings > POP3/SMTP/IMAP) instead of using your regular login password—this is a common pitfall.
2. Verify Network Connectivity to SMTP Server
Ensure the server running Analytics Worker can reach smtp.163.com on the configured port. Test with:
telnet smtp.163.com 465 # Or for SSL connections openssl s_client -connect smtp.163.com:465
If the connection fails, check for firewall/security group rules blocking outbound traffic, or switch to port 587 (TLS) if 465 is unavailable.
3. Enable Debug Logs for Detailed Error Insights
The current logs only show a generic reconnection error. Enable debug logging to see the root cause (e.g., authentication failure, SSL handshake error):
Edit <API-M_ANALYTICS_HOME>/conf/worker/log4j2.properties and add:
logger.email-sink.name = org.wso2.siddhi.extension.email.sink logger.email-sink.level = DEBUG logger.email-transport.name = org.wso2.transport.email logger.email-transport.level = DEBUG
Restart the Analytics Worker service and check the logs for specific SMTP connection errors.
4. Validate Alert Subscriber Email Configuration
While not the immediate issue, confirm that you've specified valid recipient emails in the Alert Management setup. If the emails field in the Siddhi stream is empty or invalid, emails will fail even after fixing the SMTP connection.
5. Double-Check Siddhi File Sink Configuration
Ensure your APIM_ALERT_EMAIL_NOTIFICATION.siddhi sink is correctly formatted. Your current configuration looks valid, but confirm the to='{{emails}}' is correctly mapping to the recipient list passed from the alert system.
内容的提问来源于stack exchange,提问作者Freeman

