How to configure Gmail in centos7 to send notifications to specific email id s

0 votes
Oct 5, 2020 in Linux Administration by Shashi
• 370 points
389 views

1 answer to this question.

0 votes

Hi@Shashl,

You can use python script in your CentOS system to set email notification. You can use the SMTP module in your script.

# send mail
import smtplib,getpass
sender='abc@gmail.com'
receiver=['xyz@gmail.com','zzz@gmail.com']
password='xxxxx'
smtpserver=smtplib.SMTP("smtp.gmail.com",587)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo
smtpserver.login(sender,password)
msg='Subject:Demo\nThis is a demo'
smtpserver.sendmail(sender,receiver,msg)
print('Sent')
smtpserver.close()
answered Oct 5, 2020 by MD
• 95,360 points
I want to trigger email notification through shell script.

For example : If I am running the script to get version of an application like java, docker, jenkins then script has to trigger an email to mentioned mail id's with the versions.

Hi@shashl,

You can do that. Create a simple shell script that will call the python script. So whenever you will run the shell script, it will run the required command and send an email.

Related Questions In Linux Administration

0 votes
1 answer

How to Unblock SSH and FTP Access to Specific IP in Linux?

Firewalls(most of them) can either Reject or ...READ MORE

answered Jul 16, 2019 in Linux Administration by Archana
• 5,640 points
10,149 views
0 votes
1 answer

How to configure SSH server in RHEL/CentOS?

Hi@MD, To configure SSH server to your system, ...READ MORE

answered Mar 30, 2020 in Linux Administration by akhtar
• 38,230 points
379 views
0 votes
1 answer

How to configure yum in RedHat system?

Hi@akhtar, By default, RedHat has one ISO file. ...READ MORE

answered Jul 28, 2020 in Linux Administration by MD
• 95,360 points
892 views
0 votes
1 answer

How to capture Packets from Specific Interface in Linux?

Hi@akhtar, You can use tcpdump command in your ...READ MORE

answered Oct 3, 2020 in Linux Administration by MD
• 95,360 points
377 views
0 votes
0 answers

how to grep a specific process from ps in linux?

When I ps -af | grep RV ...READ MORE

Apr 14 in Linux Administration by Rahul
• 9,000 points
81 views
0 votes
1 answer

How to increase Swap Memory in CentOS 7?

Follow the below steps and procedures: Prerequisites Must have ...READ MORE

answered Oct 5, 2018 in Linux Administration by Frankie
• 9,830 points
9,973 views
–1 vote
1 answer

How to get octal file permission in linux?

You can use this: stat -c "%a %n" ...READ MORE

answered Jan 3, 2019 in Linux Administration by Omkar
• 69,210 points
1,053 views
0 votes
1 answer

How to take input from user in bash script?

You can use if-else branch to check ...READ MORE

answered Jan 31, 2019 in Linux Administration by Omkar
• 69,210 points
460 views
+1 vote
1 answer

How to configure NFS server in Linux?

Hi@akhtar, To configure NFS server in your system, ...READ MORE

answered May 27, 2020 in Linux Administration by MD
• 95,360 points
320 views
0 votes
1 answer

How to configure FTP server in Linux System?

Hi@akhtar, You need to install vsftpd software in ...READ MORE

answered Jul 9, 2020 in Linux Administration by MD
• 95,360 points
253 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP