on
laravel
- Get link
- Other Apps
Install Mutt
sudo apt-get install mutt
Configuration Mutt, for this run below command and add some credentials
nano ~/.muttrc
# Account settings
set from = "yourmail@gmail.com"
set realname = "Your name"
set imap_user = "yourmail@gmail.com"
set imap_pass = "yourpassword"
set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed = "+[Gmail]/Drafts"
# SMTP settings
set smtp_url = "smtps://yourmail@gmail.com@smtp.gmail.com:465/"
set smtp_pass = "yourpassword"
set ssl_force_tls = yes
# Set header information
set edit_headers = yes
# Avoid certificate check (Use carefully)
set ssl_verify_host = no
set ssl_verify_dates = no
Give Permission
sudo chmod 600 ~/.muttrc
Send mail with terminal
echo "Email body text" | mutt -s "Subject" -a /home/pc/Public/neeraj/bash_scripts/bkp.zip -- yourmail@gmail.com -y
Sending mail with bash script file
Create a bash file with any name like send_mail.sh
send_mail.sh
#!/usr/bin/env bash
RECIPIENT_ADDRESS="youreceivermail@gmail.com"
SUBJECT='Test Mail'
BODY="THis is body"
MAIL_CONTENT_FILE='/home/pc/Public/neeraj/bash_scripts/bkp.zip'
echo $BODY | mutt -s $SUBJECT -a $MAIL_CONTENT_FILE -- $RECIPIENT_ADDRESS -y
Give 600 permission to send_mail.sh for this run below command
Comments
Post a Comment
If you any doubt of any topic then you can comment me.