SendEmail and Variable

Hi everyone,

I try to send an email with "sendemail", I created four variables for do cleaner but it doesn't work :frowning: below :

#!/bin/bash

sender=$(X@x.com)
recipient=$(x@x.com)
subject=$(Files Copy)
server=$(x.x.x.x)

/usr/bin/sendemail -f $sender -t $recipient -u $subject -m blablabla -s $server

I try with or without "", '', for variable but the same thing.

Output :

Sep 22 15:31:16 server-x sendemail[8608]: WARNING => The argument after -f was not an email address!
Sep 22 15:31:16 1 server-x sendemail[8608]: WARNING - The argument after -s was not the server!
Sep 22 15:31:16 server-x sendemail[8608]: ERROR => You must specify a 'from' field!  Try --help.

Thanks by advance. :slight_smile:

$(X@x.com)

$() is a command substitution.

you need to enter the address/server/subject etc without $().

1 Like

Thanks ! it work ! :b::b::slight_smile: