LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-13-2008, 05:27 AM   #1
LMSSML
Member
 
Registered: Nov 2007
Distribution: Ubuntu Server and Desktop
Posts: 41

Rep: Reputation: 15
Smile Send Mail with auto reply


Hi people,

I'm newbie with sendmail and I'm having a problem, probably it's easy to do it but I've got a user that I want to configure a message "Out of Office".
I've tried to search on the internet I found a site something like this

Quote:
Linux security: mail, sendmail, fetchmail, procmail...

Sending automatic reply-mails

You can do this by checking e-mails automatically. I decided:

1. to get my e-mails
2. to let them check additionally

Create a file .forward in your homedirectory like this for a user wwwrun which shall get mails from persons with a special headline:

\wwwrun,"| /home/wwwrun/forward.pl"

This means that the mail gets delivered to the user himself AND to the programm mentioned. The program forward.pl is not too sophisticated:

#!/usr/bin/perl
# file ~/forward.pl
# called by ~/.forward which looks like this for user wwwrun:
# wwwrun,"| /home/wwwrun/forward.pl"
#
# mission: generate automatic mails as answers
#
BEGIN {
use lib "/usr/local/bin/hor.module";
}
use mailhor;
# This is valid for all mails generated here:
my $smtpserver = "gatekeeper.rosi13.de";
my $from = 'wwwrun@gatekeeper.rosi13.de';
# my $cc = 'horshack@gatekeeper.rosi13.de';
my $cc = '';

# Parse this mail:
my ($org_subject,$org_from,$org_replyto) = (undef,undef,undef);
my @mail = <STDIN>;
foreach (@mail) {
$org_subject = $1 if (/^Subject: (.*)$/i);
$org_from = $1 if (/^From: (.*)$/i);
$org_replyto = $1 if (/^Reply-To: (.*)$/i);
}
# Analyze
if ($org_subject =~ /please give me password for msdos-bootdisk/) {
&send_disk_password(to=>$org_from,cc=>$cc);
system "logger \'sending dos-password-mail to $org_from\'";
}
exit;

sub send_disk_password {
my (%args) = @_;
my $to = $args{to};
my $cc = $args{cc};
my $subject = "Re: please give me password for msdos-bootdisk";
my $body =<<'EODISKPASSWORD';
Hi,
thanks for your interest... blablabla.
From Nuernberg, Bavaria
yours
Richard Lippmann
EODISKPASSWORD
&mailhor::sendamail(smtpserver=>$smtpserver,from=> $from,
to=>$to,cc=>$cc,subject=>$subject,body=>$body);
}
I don't know if it's better or the worst but indicates me that could be done with a little script, although the script won't work because when we sent an e-mail for the specific user the mail must return a message with out of office and that dosen't happend.

Help !!!!

Best Regards
 
Old 05-13-2008, 06:38 PM   #2
LMSSML
Member
 
Registered: Nov 2007
Distribution: Ubuntu Server and Desktop
Posts: 41

Original Poster
Rep: Reputation: 15
Does anyone could help?

Hi people

Probably could be a dummy question buyt does anyone knows how to do it ?

Thanks
Best Regards
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix : mail cannot send to send outside ( can send/receive locally) bobbinsupport Linux - Networking 3 12-15-2007 11:40 PM
Mail auto reply novis Linux - Software 2 05-08-2006 10:44 AM
coding problem on php auto send mail after a period akamaru607 Programming 12 09-01-2005 08:48 AM
Vacation Auto reply elainepearl Linux - Software 0 07-17-2003 04:26 AM
Auto reply jayakrishnan Linux - General 1 03-28-2002 05:39 AM


All times are GMT -5. The time now is 03:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration