Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Absolute Beginner Talk
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.
Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

Absolute Beginner Talk
The perfect starting place to find out more about computers, Linux and Ubuntu.

 
Thread Tools Display Modes
Old January 11th, 2007   #1
nhandler
Ubuntu Developer
 
nhandler's Avatar
 
Join Date: Aug 2006
My beans are hidden!
Ubuntu 9.10 Karmic Koala
Send email through script

I've been trying for a while to set up a way to send emails from a perl script or even the terminal. Currently, I use thunderbird to send email. It uses my gmail account and smtp.gmail.com to send the mail. smtp.gmail.com requires all these authentication things to work (http://mail.google.com/support/bin/a...87&topic=1556). Is there any way I can connect to smtp.gmail.com to send mail from the perl script/terminal? I don't need to be able to read mail, just send it. If I could send from an email account other than my own (without making a new account), that would be even better. I have a feeling that will involve a different smtp server, which is fine, as long as it works.
nhandler is offline   Reply With Quote
Old January 13th, 2007   #2
Ecthelion
Skinny Soy Caramel Ubuntu
 
Ecthelion's Avatar
 
Join Date: Dec 2005
Location: EU - Belgium
Beans: 664
Ubuntu 9.10 Karmic Koala
Re: Send email through script

I have a link here for a terminal command to send emails.

Is this what you are looking for?
__________________
When you have a problem, look up what's the source...
Otherwise it's like being mad with the lamp when the light goes out, instead of noticing that there's a power breakdown in your city.
Ecthelion is offline   Reply With Quote
Old January 13th, 2007   #3
Ecthelion
Skinny Soy Caramel Ubuntu
 
Ecthelion's Avatar
 
Join Date: Dec 2005
Location: EU - Belgium
Beans: 664
Ubuntu 9.10 Karmic Koala
Re: Send email through script

Quote:
| Internet site - mail is sent and received directly using SMTP. If your
│ needs don't fit neatly into any category, you probably want to start
│ with this one and then edit the config file by hand.
│ ▮
Internet site using smarthost - You receive Internet mail on this
│ machine, either directly by SMTP or by running a utility such as
│ fetchmail. Outgoing mail is sent using a smarthost. optionally with
│ addresses rewritten. This is probably what you want for a dialup system.
| Satellite system - All mail is sent to another machine, called a "smart
│ host" for delivery. No mail is received locally. ▒
│ ▒
Local delivery only - You are not on a network. Mail for local users is ▮
│ delivered.
Small part of the configuration...

Just try it out, configure it, and tell us if it worked for you...
__________________
When you have a problem, look up what's the source...
Otherwise it's like being mad with the lamp when the light goes out, instead of noticing that there's a power breakdown in your city.
Ecthelion is offline   Reply With Quote
Old January 13th, 2007   #4
souki
Gee! These Aren't Roasted!
 
Join Date: Jan 2005
Location: Europe/France
Beans: 219
Re: Send email through script

gmail uses smtp over ssl
so, I think you should use the Net::SMTP::SSL module
souki is offline   Reply With Quote
Old January 13th, 2007   #5
KeithEckstein
First Cup of Ubuntu
 
Join Date: Aug 2006
Location: Brittany - France
Beans: 5
Ubuntu 6.06
Re: Send email through script

Cheater

I don't know if this is what you are after but I send mail to a Gmail account as part of my nightly backup process - I use MUTT to do this.

The relevant portion of the backup script is as follows...

# And now Mail it to Mozart.Archive@Gmail.com
mutt -s "MailBack" -a /home/keckstein/Data/Tars/MailBack.tar.gz MozartArchive@Gmail.com < backuplog.000

I can obviously do the same thing from the console without having to run it in a script.

Hope this helps

Keith (learning a little more, every day)
KeithEckstein is offline   Reply With Quote
Old January 13th, 2007   #6
speedman
Gee! These Aren't Roasted!
 
speedman's Avatar
 
Join Date: Apr 2005
Location: ON, TN, FL
Beans: 160
Re: Send email through script

http://caspian.dotconf.net/menu/Software/SendEmail/

SM
speedman is offline   Reply With Quote
Old January 16th, 2007   #7
nhandler
Ubuntu Developer
 
nhandler's Avatar
 
Join Date: Aug 2006
My beans are hidden!
Ubuntu 9.10 Karmic Koala
Re: Send email through script

Quote:
Originally Posted by speedman View Post
That program worked perfectly. Now, I just need to remember how to execute terminal commands from within a perl script.
nhandler is offline   Reply With Quote
Old January 16th, 2007   #8
souki
Gee! These Aren't Roasted!
 
Join Date: Jan 2005
Location: Europe/France
Beans: 219
Re: Send email through script

with perl, you can use back-quotes :
Quote:
`the_shell_command args`;
souki is offline   Reply With Quote
Old January 16th, 2007   #9
nhandler
Ubuntu Developer
 
nhandler's Avatar
 
Join Date: Aug 2006
My beans are hidden!
Ubuntu 9.10 Karmic Koala
Re: Send email through script

Quote:
Originally Posted by souki View Post
with perl, you can use back-quotes :
I never new that before. That's pretty cool.
nhandler is offline   Reply With Quote
Old January 13th, 2007   #10
Ecthelion
Skinny Soy Caramel Ubuntu
 
Ecthelion's Avatar
 
Join Date: Dec 2005
Location: EU - Belgium
Beans: 664
Ubuntu 9.10 Karmic Koala
Re: Send email through script

Quote:
I don't know if this is what you are after but I send mail to a Gmail account as part of my nightly backup process - I use MUTT to do this.


The link I posted previously was to a page where was explained how to install & use MUTT

Note to myself: say to where a posted link goes


To be quite honest, I'm glad someone else recommends it... I just googled for a prog that could be used to send emails using Script/Command-line.
But as I tested it myself it didn't worked...

When I first installed it it asked me to choose one of these
Quote:
| Internet site - mail is sent and received directly using SMTP. If your
│ needs don't fit neatly into any category, you probably want to start
│ with this one and then edit the config file by hand.
│ ▮
│ Internet site using smarthost - You receive Internet mail on this
│ machine, either directly by SMTP or by running a utility such as
│ fetchmail. Outgoing mail is sent using a smarthost. optionally with
│ addresses rewritten. This is probably what you want for a dialup system.
| Satellite system - All mail is sent to another machine, called a "smart
│ host" for delivery. No mail is received locally. ▒
│ ▒
│ Local delivery only - You are not on a network. Mail for local users is ▮
│ delivered.
However, I think I choosed wrong and configured it wrongly.
Does one of you know how I could reconfigure it using the menus that appeared then?

Reinstalling etc doesn't work


Also, could you tell how you configured it to work with your gmail?


[EDIT]
Nevermind, tried sendemail and that worked fine.
[/EDIT]
__________________
When you have a problem, look up what's the source...
Otherwise it's like being mad with the lamp when the light goes out, instead of noticing that there's a power breakdown in your city.

Last edited by Ecthelion; January 13th, 2007 at 12:06 PM..
Ecthelion is offline   Reply With Quote

Bookmarks

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

Forum Jump


All times are GMT -4. The time now is 04:15 AM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry