Postfix SMTP Authentication Failed

I am using centos 7 Finally it works! I was getting this issue(tail -f /var/log/mailog):

to=<[email protected]>, relay=smtp.sendgrid.net[169.45.113.201]:587, delay=0.3, delays=0.05/0.07/0.16/0.02, dsn=5.0.0, status=bounced (host smtp.sendgrid.net[169.45.113.201] said: 550 Unauthenticated senders not allowed (in reply to MAIL FROM command))

Then i changed file /etc/postfix/main.cf in this way that added following lines into end of file

mtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
mailbox_size_limit = 256000000

# Sendgrid Settings
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:apikey:SG.YOUR_SENDGRID_KEY
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587

Then Installing postfix missing module dependency using:

sudo yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain

Then restarting postfix

sudo systemctl restart  postfix.service