Command line email help needed

Hi,

having some problems getting commandline mail to work for root user in ubuntu.
Ive installed the following packages - msmtp & mailx and the cert for gmail.

I've created 3 files: mailrc and msmtprc in /home/username directory
and /etc/exim4/passwd.client

mailrc
------
set from="USER@gmail.com (ME)"
set sendmail="/usr/bin/msmtp"
set message-sendmail-extra-arguments="-a gmail"

MSMTPRC
-------
# config options: msmtp 1.4.21
#A-user-configuration-file
defaults
logfile /tmp/msmtp.log

# gmail account
account gmail
auth on
host smtp.gmail.com
port 587
user USER@ mail.com
password PASSWORD
from USER@gmail.com
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
#set default account to use (not necessary with single account)
account default : gmail

passwd.client
-------------
*.google.com:yourAccountName@gmail.com:y0uRpaSsw0RD

Then issuing the command
echo "test" | mailx -s "this is a test" myemail@gmail.com

Works perfectly for normal user accounts, but when I try to do the same with root I get the following error

'send-mail: /root/.msmtprc: line 16: unknown command set
Can't send mail: sendmail process failed'

There is no 'msmtprc' config file in /root and even when created I get the same error.

Im totally confused to why its displaying the error, also no logfile is created.

Any help would be gratefully received.

Thanks, Lee.