SendEmail and Variable


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SendEmail and Variable
# 1  
Old 09-22-2016
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 Smilie below :
Code:
#!/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 :
Code:
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. Smilie

Last edited by Arnaudh78; 09-22-2016 at 11:00 AM..
# 2  
Old 09-22-2016
Code:
$(X@x.com)

$() is a command substitution.

you need to enter the address/server/subject etc without $().
This User Gave Thanks to greet_sed For This Post:
# 3  
Old 09-22-2016
Thanks ! it work ! SmilieSmilieSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sendemail how to send an email with a subject variable

Hi,:) I try this : #!/bin/bash sender="me@example.com" recipient="you@example.com" subject="TEST FILE" server="0.0.0.0" file=$(cat file.txt) /usr/bin/sendemail -f $sender -t $recipient -u $subject -m $file My file.txt: BLABLALA BLABLABLA (7 Replies)
Discussion started by: Arnaudh78
7 Replies

2. UNIX for Dummies Questions & Answers

Sendemail Error - Authentication... failed

SCO Unix OpenServer v6. We use the script below for sending mass emails with attachments. sendemail -f $From_user -o message-file=/u/fg4/data/EmailDefaultBody.html -u $su bj -s $MAIL_SRVR -xu $MAIL_USER -xp $MAIL_PSWD -a $emlname.pdf -t $MAILTO MAIL_SVR=SMPTOUT.SECURESERVER.NET ... (0 Replies)
Discussion started by: jet47
0 Replies

3. Solaris

Send multi content email using sendemail utility

Hi Guys, I am trying to send email from solaris server using sendemail utility. I want to send multi content email. For example, i want to send email body with html file and a attachment of txt file. I using below code but the html not render correctly in email body. ( echo "To:... (2 Replies)
Discussion started by: tharmendran
2 Replies

4. Ubuntu

Sendemail... is there a receivemail?

Hello, I installed the sendemail program for commandline/script outgoing mail. It works great. I was wondering if there is some simple program to receive mail. Something like the sendemail program... Grtz (5 Replies)
Discussion started by: raylier
5 Replies

5. Shell Programming and Scripting

SendEmail - Script reading database file with sleep command

Hello, I would like to send email message to my mail list. I have been running linux based server and I submitted this process manually up to now. I would like to send each individual with a shell script. In ssh panel, I tested below command and it works smoothly. sendEmail -t... (1 Reply)
Discussion started by: baris35
1 Replies

6. Solaris

Solaris 10 Sendemail with Attachment

Hello I need your kind help for configuring email on Solaris 10 so I can send reports from the system to my management and my colleagues. I have the IP address of the email server of my company and the port 2525. I went through many documents online with no luck. Can any one help me... (4 Replies)
Discussion started by: samer.odeh
4 Replies

7. Shell Programming and Scripting

[Solved] How to increment and add variable length numbers to a variable in a loop?

Hi All, I have a file which has hundred of records with fixed number of fields. In each record there is set of 8 characters which represent the duration of that activity. I want to sum up the duration present in all the records for a report. The problem is the duration changes per record so I... (5 Replies)
Discussion started by: danish0909
5 Replies

8. Shell Programming and Scripting

sendEmail: Script and Array

I have a script that send email using sendEmail (CentOS shell) script is: sendEmail -vvv -u "TestCompany, Inc.: USB Added" -f user@domain.com -t To@domain.com -s ASPMX.L.GOOGLE.com -m "USB Activity" -o tls=aut o username=user3@domain.com password=password So far this works fine. Now i... (5 Replies)
Discussion started by: kashif.live
5 Replies

9. Shell Programming and Scripting

How to define a variable with variable definition is stored in a variable?

Hi all, I have a variable say var1 (output from somewhere, which I can't change)which store something like this: echo $var1 name=fred age=25 address="123 abc" password=pass1234 how can I make the variable $name, $age, $address and $password contain the info? I mean do this in a... (1 Reply)
Discussion started by: freddy1228
1 Replies
Login or Register to Ask a Question