Open Laboratory for Technocrats

Grab the developer role, learn concepts & prepare with senior software engineers to get solutions for problems in a software job. Coding and Programming Solutions crafted for you.

Sending emails from CMD using MUTT on Unix

MUTT



WHAT

Command line based client for managing emails. It is a powerful tool to use for reading and sending emails from CMD in Unix based operating systems. It also supports POP and IMPA protocols for receiving emails.

WHY


  • Easy to install and configure
  • Emails with attachments from the command line
  • BCC (Blind carbon copy) and CC (Carbon copy) while sending emails
  • Message threading
  • Facility of mailing lists
  • Support for mailbox formats like Maildir, mbox, MH, and MMDF
  • 20+ Language support
  • DSN (Delivery Status Notification) Support


HOW

Installation is simple as:
For Debian / Ubuntu based system
apt-get install mutt
or

For RHEL / CentOS / Fedora based system
yum install mutt

Configuration

Now we need to take care of config file which will handle the sender details and other information regarding email
Master configuration file “/etc/Muttrc“
User Specific configuration file "~/.muttrc" or "~/.mutt/muttrc" files

Change/Add details to the config file:
set from = "user@domain.com"
set realname = "Realname of the user"

Basic Syntax- 

mutt options recipient

Example:
mutt -s "Test Email" openT@openTest.com

This will give you the basic access to the use it.
Reference for this article is https://www.tecmint.com/send-mail-from-command-line-using-mutt-command/ you can learn a lot more.

Keep Learning 

Removing Gaps Under Images while Slicing for Email Campaigns


 
Running an email campaign for your business and making things looking good with the efforts of images buy the designer and it looks awesome and then you are ready to go for the trial email to test everything in working fine.

And the test begins .... ohhhhh it's taking some long to load the image on the email client or so.

We can figure a solution for this problem as "Image Slicing"

After figuring the image thing with the help of designer now the next thing will hit you on your next run of the test email.

Oh, bizarre why are this empty spaces are there in the images, I didn't put any <br> tags over there.


Its a known issue nowadays with the email campaign and we can solve it easily with the inline styles as putting style="display:block;" but make sure that you are using the alignment of the page as left otherwise things may look wired.

If you are going for centred alignment then you might better not to use this as it happened to me but it was just as another case.

Although we can also use the inline styling as margin-top:10px; or whatever the spaces that we need to manage.

More can be grasped at here

Comment if faced any issue.

#Cheers for learning

Ubuntu - Send Email From Terminal


Today I was doing some stuff and suddenly my system stopped working, I went on to check the RAM it was heavy due to this cleaning process I went to some cool websites and found some new stuff today and that stuff was that we can send Email from Ubuntu's Terminal.

Here are the steps that I followed to send the Email from terminal about my processes that are running into my ubuntu system.

Step 1 - Download and install ssmpt with command    apt-get update && apt-get install ssmtp 
Step 2 - Configure Smart Host by making changes to file with command     gedit /etc/ssmtp/ssmtp.conf    
Step 3 - Now configure your username and password Example goes with  GMAIL as:

 AuthUser=YOUR_GMAIL_ID@gmail.com 
 AuthPass=Your-Gmail-Password              
 FromLineOverride=YES                            
 mailhub=smtp.gmail.com:587                   
 UseSTARTTLS=YES                                

Step 4 - Save and close the file.

After that I had a thought to get the my systems process information on my email id.
For that I run this command into my terminal and it was working fine.

  top -b -n1 | mail -s 'Ubuntu System Information' you@example.com  

And it worked absolutely fine in my system, Hurray I got the mail, Even we can have this on our server so that we can track the things from CRON JOBS to get the interval status on our emails.

Thanks to cyberciti for quick learning 
Enjoy Learning :)

Top #3 Articles

Most Read