2

I am having trouble attaching more than one attachment. These attachments are in different formats. I already tried separating the the attachment patterns with a space too.

emailext(
attachLog: true,
body: "xxxxxxxxxxxxxx",
attachmentsPattern: '**/*.fpr; **/testing.txt',
compressLog: true,
subject:.........."
to: '......'
)
Kyle Kim
  • 41
  • 1
  • 1
  • 3

1 Answers1

2

Use comma separation within the single quotes I attached multiple files by the pattern 'test/forEmail*, test/myPdf3*':

emailext attachmentsPattern: 'test/forEmail*, test/myPdf3*', body: '''${SCRIPT, template = "emailTest1-html.template"}''', mimeType: 'text/html', replyTo: 'datmil1@ford.com', subject: 's1', to: 'rjone646@ford.com'

Original Answer:

If you don't want to change your file names to fit a single pattern, you can copy files to a single folder in your workspace then send everything in the folder.

For example, I copied all files that I want to email to a folder called test, then I sent everything in that folder with the pattern 'test/*'

emailext attachmentsPattern: 'test/*',body: '''${SCRIPT, template = "emailTest1-html.template"}''', mimeType: 'text/html', replyTo: 'blah@blah.com', subject: 's1', to: 'fake@email.com'

If you need an example of how to copy files in windows hosted jenkins:

bat "copy \"C:\Program Files (x86)\Jenkins\jobs\${env.JOB_BASE_NAME}\builds\${env.BUILD_NUMBER}\htmlreports\Test_20Automation_20Report\TestExecutionReport_SL MIL.html\" test\TestExecutionReport_SL_MIL.html"

ryan jones
  • 63
  • 6