You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Jenkins Email Ext插件无法触发含TestNG报告的邮件求助

Troubleshooting "No emails were triggered" & Sending TestNG Reports via Jenkins

Hey there, let’s work through this Jenkins email issue together to get your TestNG reports sent out successfully! Here’s a step-by-step breakdown of what to check and fix:

1. First, Confirm Your Email Trigger Conditions

The "No emails were triggered" message almost always means your task didn’t meet the rules you set for sending emails. Let’s verify that first:

  • Go to your Jenkins task → Configure → Scroll to Post-build Actions (look for Editable Email Notification or the Email Extension plugin you’re using)
  • Check the Triggers section: Make sure you’ve selected at least one trigger that matches your task’s outcome. For testing, pick Always (sends email no matter if the build passes or fails) — you can adjust this later once things work.
  • Double-check the Send to field: Ensure you’ve entered a valid recipient email address (no typos, no empty fields!).

2. Make Sure TestNG Reports Are Actually Generated

If the reports don’t exist, Jenkins can’t include them in emails. Let’s confirm:

  • After running your task, go to the task’s Workspace and look for the test-output folder (TestNG’s default output directory). Inside, you should see index.html and other report files.
  • If the folder is missing, troubleshoot your TestNG setup first: Check your build command (like mvn test or an Ant task) to make sure it’s running TestNG tests without errors. Fix any test execution issues before moving on.

3. Add TestNG Reports to Your Email (Two Options)

Option 1: Attach the Report as a ZIP File

This is straightforward and works with most email clients:

  • Add a Archive the artifacts post-build action to your task:
    • Enter test-output/**/* as the files to archive — this saves the report files in Jenkins.
  • To package the report into a ZIP (cleaner for attachments), add a shell build step before the email action with this command:
    zip -r testng-report.zip test-output/
    
  • Then, in your email configuration’s Attachments field, enter testng-report.zip — Jenkins will include this ZIP in the email.

Option 2: Embed the Report in the Email Body

If you want the report visible directly in the email (note: some clients may filter styles), use the HTML Publisher plugin:

  • First, install the HTML Publisher Plugin from Jenkins’ plugin marketplace if you haven’t already.
  • Add a Publish HTML reports post-build action:
    • Set HTML directory to archive to test-output
    • Set Index page[s] to index.html
    • Tick Allow untrusted HTML (this lets Jenkins render the report’s styling)
  • In your email configuration, set the Content Type to HTML, then add this to the body:
    <h3>TestNG Test Results</h3>
    <p>View the full report <a href="${BUILD_URL}HTML_Report/">here</a>, or see a preview below:</p>
    ${FILE,path="test-output/index.html"}
    
  • Pro tip: If direct embedding causes formatting issues, just stick to the link to Jenkins’ hosted report — it’s reliable and preserves all styling.

4. Verify Jenkins’ Global Email Settings

Sometimes the problem is with Jenkins’ overall email setup, not your task:

  • Go to Manage Jenkins → Configure System → Find Extended E-mail Notification (or E-mail Notification)
  • Confirm your SMTP server, port, authentication credentials (username/password), and sender email are all correct. Click Test configuration to send a test email — this will confirm if Jenkins can connect to your email server.
  • For third-party emails like Gmail, make sure you’ve enabled SMTP access (e.g., use an App Password if 2FA is turned on, or allow less secure apps temporarily for testing).

5. Test with a Simplified Setup

If you’re still stuck, strip down the configuration to isolate the issue:

  • Set the email trigger to Always and attach a small, existing file (like README.md) instead of the TestNG report. Run the task — if you get this email, the problem is with how you’re integrating the TestNG report, not the email itself.
  • Once the basic email works, gradually add back the TestNG report configuration to pinpoint where things break.

If none of this works, check your task’s Console Output for clues — search for keywords like "email" or "mail" to find specific error messages (e.g., permission issues, missing files).

内容的提问来源于stack exchange,提问作者user3091748

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 08:22:30