www.zeroshell.org Forum Index www.zeroshell.org
Linux Distribution for server and embedded devices
 
 SearchSearch  RegisterRegister  UsergroupsUsergroups 
 ProfileProfile  Log inLog in  Log in to check your private messagesPrivate Message 

send mail

 
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> ZeroShell
View previous topic :: View next topic  
Author Message
redfive



Joined: 27 Aug 2009
Posts: 232

PostPosted: Wed Jun 30, 2010 7:22 pm    Post subject: send mail Reply with quote

Hi there, I'd like to send a mail when the sistem reboots , but I'm not able to do this Sad .....I tried to make a test with a script like this in cronjob , but doesn't works
Code:

#!/usr/bin/perl

use Net::SMTP;

$remote_smtp_host = 'smtp.dominio.tld';

$sender = 'indirizzo email del mittente';
$sender_name = 'nome del mittente';

$recipient = 'indirizzo email del destinatario';
$recipient_name = 'nome del destinatario';

$subject = 'Sendmail.pl Test';

$body = "Questo e\' un test dello script Sendmail.pl\n";

$smtp=Net::SMTP->new("$remote_smtp_host") or die($!);
$smtp->mail("$sender");
$smtp->to("$recipient");
$smtp->data();
$smtp->datasend("Subject: $subject\n");
$smtp->datasend("To: $recipient_name <recipient>\n");
$smtp->datasend("From: $sendername <sender>\n");
$smtp->datasend("$body");
$smtp->dataend();
$smtp->quit;


the zeroshell returns the following message
Code:

/tmp/ScriptToRun21973: line 4: use: command not found
/tmp/ScriptToRun21973: line 6: =: command not found
/tmp/ScriptToRun21973: line 8: =: command not found
/tmp/ScriptToRun21973: line 9: =: command not found
/tmp/ScriptToRun21973: line 11: =: command not found
/tmp/ScriptToRun21973: line 12: =: command not found
/tmp/ScriptToRun21973: line 14: =: command not found
/tmp/ScriptToRun21973: line 16: =: command not found
/tmp/ScriptToRun21973: line 18: syntax error near unexpected token _('
/tmp/ScriptToRun21973: line 18: __smtp=Net::SMTP->new("_remote_smtp_host") or die(_!);'

[Cron mail]: ERROR (2)


Maybe I've to install this pearl module ??

http://search.cpan.org/~gbarr/libnet-1.22/Net/SMTP.pm

How can I do it ?
thanks !!
jonatha
Back to top
View user's profile Send private message
RudolfAT



Joined: 15 Jul 2015
Posts: 3

PostPosted: Thu Jul 16, 2015 12:47 pm    Post subject: Reply with quote

With Zeroshell 3.3.2, there is a built-in feature "Monitoring", which can send e-mails on various events and also at shutdown and restart.

For manually sending mails, see "/usr/bin/smtp-cli --help".
Back to top
View user's profile Send private message
approved_ok



Joined: 30 Sep 2012
Posts: 4

PostPosted: Sat Jul 18, 2015 5:44 am    Post subject: Email not working Reply with quote

using Monitor for emailing (via gmail) always get the message:

Connect failed: IO::Socket::INET6: connect: timeout

tried manually from smtp-cli got the same message

can anyone help me ??
Back to top
View user's profile Send private message
getout



Joined: 15 Apr 2014
Posts: 30

PostPosted: Sun Jul 19, 2015 9:11 pm    Post subject: Reply with quote

I haven't been able to get Gmail SMTP working in the Monitoring settings. Try using an SMTP email server on your LAN, maybe your router has an SMTP relay you could use or you could try using the SMTP settings of your ISP.

Once operational the Monitoring Module is very convenient. Don't forget to add your email recipients.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> ZeroShell All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group