nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Shell Script To Send Email via SMTP username and password

This is a discussion on Shell Script To Send Email via SMTP username and password within the Shell scripting forums, part of the Development/Scripting category; hey.. i am seeking for a linux script(Shell script) that reads from text file "email addresses" and send a "message" ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 05-27-2008, 10:14 PM
Member
User
 
Join Date: May 2008
My distro: Debian
Posts: 32
Rep Power: 0
eawedat is on a distinguished road
Lightbulb Shell Script To Send Email via SMTP username and password

hey..
i am seeking for a linux script(Shell script)
that reads from text file "email addresses" and send a "message"
by smtp server which i set !

for example..
lets say that i have in my shell 2 files!
one file includes the email addresses that i wanna send to
for example.. the file which is named emails contains :-

koko @hotmail.com
veko@hotmail.com
xxxxxxx@.....com
...

and the second file which has the message for example:.
the file message contains the letter

"welcome all to my world"

now i want to send the letter/message "welcome all to my world" to the email addresses that i mentioned above "koko@hotmail.com veko@hotmail.com ,,etc"

*note: i could use the pine / mail command ,, but as you know all.. pine and mail sends to junk/or as a spam for hotmail.. so i wanna be sure that my message was delivered to users in their inbox and not in junk
for that reason i wanna specific/special script mailer that sends via my "gmail" account that i set(configure)
for example:-

port:23
smtp-server:smtp.gmail.com
user:eawedat
password:*****
and to send via my email..

the script should look like this to run in linux..

./mail emails message

I hope that u understand me.
thanks.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-28-2008, 12:38 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 910
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

This is not hard, you have many choices

# 1 - Configure local email server to send an email via ISP SMTP server and write normal shell scrip to router all mail using mail command. This is easiest and works with everything.

# 2 - Use special smtp mail client such as
Software :: SendEmail - Send email with this free command line email client
mailsend - send mail via SMTP Protocol
Google for other software

# 3 - use perl / php to send email
php example PHP Send Email Using Authenticated SMTP Mail Server In Real Time

Perl code
Sending mail with Perl mail script
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #3 (permalink)  
Old 05-28-2008, 07:33 PM
Member
User
 
Join Date: May 2008
My distro: Debian
Posts: 32
Rep Power: 0
eawedat is on a distinguished road
Smile

thank you very much nixcraft
can you please explain to me the first step ? #1 in commands


best regards,
eawedat.
Reply With Quote
  #4 (permalink)  
Old 05-31-2008, 05:38 PM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 910
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Quote:
Originally Posted by eawedat View Post
thank you very much nixcraft
can you please explain to me the first step ? #1 in commands


best regards,
eawedat.
Use sendmail as smarthost, see
Configure sendmail as a smart host : nixCraft
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #5 (permalink)  
Old 05-31-2008, 08:11 PM
Member
User
 
Join Date: May 2008
My distro: Debian
Posts: 32
Rep Power: 0
eawedat is on a distinguished road
Default thanks nixcraft

smart brain nixcraft
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
shell script to send mail for each login. ephdia Shell scripting 2 11-27-2007 04:42 PM
shell scripting + send mail with header ephdia Shell scripting 0 11-27-2007 11:29 AM
A script for generating cPanel backup and send as email vivekv Shell scripting 0 10-20-2007 08:28 PM
can not find the username in /etc/passwd file subrata1in Getting started tutorials 5 03-27-2007 11:45 AM
Shell script to supply or input a password passphrase kasimani Shell scripting 1 02-21-2007 09:21 AM


All times are GMT +5.5. The time now is 05:39 AM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36