Groovy: Select all
// Resend API KEY
def auth = '<YOUR RESEND API KEY>'
// Email Address
def email = '<YOUR EMAIL ADDRESS>'
// generate HTML code
def subject = "FileBot finished processing ${model.size()} files."
def html = XML {
html {
head {
meta(charset:'UTF-8')
style('''
p{font-family:Arial,Helvetica,sans-serif}
hr{border-style:dashed;border-width:1px 0 0 0;border-color:lightgray}
table a:link{color:#666;font-weight:bold;text-decoration:none}
table a:visited{color:#999;font-weight:bold;text-decoration:none}
table a:active,table a:hover{color:#bd5a35;text-decoration:underline}
table th{padding:15px 15px 12px 15px;background:#ededed}
table th{text-align:center;padding-left:20px}
table tr{text-align:left;padding-left:20px}
table td{padding:15px;border-top:1px solid #ffffff33;border-bottom:1px solid #e0e0e0;border-left:1px solid #e0e0e0;background:#fafafa;white-space:nowrap}
table td:first-child{text-align:left;padding-left:20px;border-left:none}
table tr td:first-child{border-top-left-radius:4px;border-bottom-left-radius:4px}
table tr td:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px}
table tr:last-child td{border-bottom:none}
table tr:hover td{background:#f2f2f2}
table{width:100%;color:#666;font-family:Arial,Helvetica,sans-serif}
section{overflow:auto;background:#eaebec;border:#ccc 1px solid;border-radius:4px;box-shadow:0 1px 2px #d1d1d1}
''')
title(subject)
}
body {
p {
span(subject)
}
hr()
section {
table {
tr {
th 'Original Name'
th 'New Name'
th 'New Location'
}
model.each{ source, target ->
tr{
td source.name
td target.name
td target.parent
}
}
}
}
}
}
}
// send HTML email via Resend API
curl 'https://api.resend.com/emails', [from:'FileBot <[email protected]>', to:email, subject:subject, html:html], 'Authorization':"Bearer ${auth}", 'Content-Type':'application/json'