0

I'm writing a bash script that sends an email to users if their AWS key is out of date. I want to include a clickable link to a Service Now ticket they can use to have their AWS keys rotated.

This is the part of the script that sets the text for the email:

fusion_link='<a href="https://company.service-now.com/myfusion?id=sc_cat_item&sys_id=7949c77e6ffc310048c83cb44b3ee4a7">Change AWS Configuration</a>'
   template1="Hello $first_name, \n\nYour access key: $user_access_key1 for user name: $user_name was created on $date1 and needs to be replaced.\n\nThis key is in AWS Account: $aws_key ($accountnumber).\n\nPlease open up a fusion ticket using this catalog item: $fusion_link to have Cloud Ops rotate your keys.\n\nAll AWS Keys need to be replaced if they are older than 90 days.\n\nRegards,\nCloud Ops"

But when the email arrives in Outlook (with HTML turned on) this is the output I get. The link is not formed so that a user can click it:

Hello Tim, 

Your access key: AKIAI7EYXZMWBBAOLYJA for user name: tdunphy was created on Thu Jan  4 16:03:32 EST 2018 and needs to be replaced.

This key is in AWS Account: company-ab-nonprod (151528745488).

Please open up a fusion ticket using this catalog item: <a href="https://company.service-now.com/myfusion?id=sc_cat_item&sys_id=7949c77e6ffc310048c83cb44b3ee4a7">Change AWS Configuration</a> to have Cloud Ops rotate your keys.

All AWS Keys need to be replaced if they are older than 90 days.

Regards,
Cloud Ops

I am sending the email in the bash script using this line:

echo -e  "$template1" | /usr/bin/mail -s "AWS Key Rotation Needed for $user_name in $aws_key" "$email_address"

The anchor tag is there in the email but it is not clickable. How can I format the link properly so that a user can click it?

bluethundr
  • 1,005
  • 17
  • 68
  • 141

0 Answers0