Score:0

Send mail with subject as string variable

hk flag

Ubuntu noob here, I want to send an email where I get subject from variable inside sh script, in script below notice subject variable. Mail is sent but the subject is "$subject" instead of SSH login

#!/bin/bash
##This script sends a message

    subject="SSH Login:"
    curl -s --user 'api:key-xxxxxxxxxxxxxxx' https://api.eu.mailgun.net/v3/adoptatias.com/messages -F from='Excited User <postmaster@mydomain.com>' -F to='mymail@gmail.com' -F subject='$subject' -F text='Detected succesfull SSH login'


exit 0;

what am I doing wrong?

hr flag
Single quotes prevent variable expansion - see for example https://askubuntu.com/a/20041/178692
guiverc avatar
cn flag
You've tagged your release as 14.04? Are you sure you're using the 2014-April release, and it's EOSS (*end of standard support*) thus off-topic here, and only gets security updates/fixes if ESM is applied?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.