Create ruby script to check SMTP with login credential.
You can test two authentication in this script i.e. plain and login.
vi /opt/rubymailtest.rb
require 'net/smtp'
message = <
From: info@homework.do
To: sbtoalerts@gmail.com
Subject: test message
Date: Sat, 23 Jun 2001 16:26:43 +0900
This is a test message.
END_OF_MESSAGE
#Net::SMTP.start('mail.exmaple.com') do |smtp|
# smtp.send_message message, 'info@homework.do',
# 'sbtoalerts@gmail.com'
# PLAIN
#Net::SMTP.start('mail.example.com', 25, 'mail.example.com',
# 'Your Account', 'Your Password', :plain)
# LOGIN
Net::SMTP.start('mail.example.com', 25, 'mail.example.com', 'username', 'passwd', :login) do |smtp|
smtp.send_message message, 'info@homework.do',
'sbtoalerts@gmail.com'
#puts " done"
end
You can test two authentication in this script i.e. plain and login.
vi /opt/rubymailtest.rb
require 'net/smtp'
message = <
From: info@homework.do
To: sbtoalerts@gmail.com
Subject: test message
Date: Sat, 23 Jun 2001 16:26:43 +0900
This is a test message.
END_OF_MESSAGE
#Net::SMTP.start('mail.exmaple.com') do |smtp|
# smtp.send_message message, 'info@homework.do',
# 'sbtoalerts@gmail.com'
# PLAIN
#Net::SMTP.start('mail.example.com', 25, 'mail.example.com',
# 'Your Account', 'Your Password', :plain)
# LOGIN
Net::SMTP.start('mail.example.com', 25, 'mail.example.com', 'username', 'passwd', :login) do |smtp|
smtp.send_message message, 'info@homework.do',
'sbtoalerts@gmail.com'
#puts " done"
end
1 comments:
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
Devops Training in electronic city
Post a Comment