Форум Flasher.ru
Ближайшие курсы в Школе RealTime
Список интенсивных курсов: [см.]  
  
Специальные предложения: [см.]  
  
 
Блоги Правила Справка Пользователи Календарь Поиск рулит! Сообщения за день Все разделы прочитаны
 

Вернуться   Форум Flasher.ru > Архив Flasher.ru > Программирование > Perl

Версия для печати  Отправить по электронной почте    « Предыдущая тема | Следующая тема »  
Опции темы Опции просмотра
 
Создать новую тему  
Старый 09.01.2003, 18:21
Alex V. White вне форума Посмотреть профиль Отправить личное сообщение для Alex V. White Посетить домашнюю страницу Alex V. White Найти все сообщения от Alex V. White
  № 11  
Alex V. White

Регистрация: Jul 2000
Адрес: Ukraine, Kiev
Сообщений: 102
Отправить сообщение для Alex V. White с помощью ICQ
Thumbs up Спасибо!

Коротко и ясно!
__________________
With the best regards
Alex V. White

Старый 11.01.2003, 10:10
Laser вне форума Посмотреть профиль Отправить личное сообщение для Laser Найти все сообщения от Laser
  № 12  
Laser

Регистрация: Nov 2002
Сообщений: 18
По умолчанию Господа, я не молчу, я был на работе.

Я нашел один "англоязычный" скрипт для отпрвавки почты без вызова почтового клиента. Настроил, работает. Беда только в том что он берет сообщения только с полей от кого -"subject" и откуда "email". Как настроить его для сбора информации с других полей что бы отправлять само сообщение непонятно. Я имею ввиду приходят пустые письма в которых только указывается от кого и от откуда.
Может подскажите как добавить обработку и других полей?
Вот скрипт:
#!/usr/bin/perl
#######################################################
#-----------------------------------------------------#
# BS Form (version 1.3) #
#-----------------------------------------------------#
# Copyright 1999 Brian Stanback All Rights Reserved. #
# #
# Email: webmaster@stanback.net #
# Webpage: http://www.stanback.net #
#-----------------------------------------------------#
# You are free to change this script in any way you #
# want, as long as the copyright and this message #
# remain intact. I will not be held responsable for #
# any damage this script may cause. If you use this #
# script I would appreciate a link back to my site #
# (stanback.net). Enjoy! :-) #
#######################################################

# This is a simple form which will take in a users name,
# email, phone number, message, and message subject and
# email it to you. It can read from a file and automatically
# send it to the user. Script does not require SSI.

#########################
# Declare the variables #
#########################

$mailprogram = "/usr/sbin/sendmail";
# Sendmail

$myemail = 'logo17@yandex.ru';

@required = ('email','subject');
# Required Fields

$auto_response = "False";
# Do you want an autoresponse?
# True = yes and False = no

$auto_response_file = "response.txt";
# File with the message you want to give the user
# automatically when (s)he sends the form.

#####################################################
# You don't need to change anything below this line #
#####################################################

# Parse the form
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/\;//g;
$value =~ s/\|//g;
$value =~ s/\</&gt;/g;
$value =~ s/\>/&lt;/g;
$FORM{$name} = $value;
}
$FORM{'email'} =~ s/^([^ ]+) (.*)/$1/g;

# Check for all required fields
foreach $check(@required)
{
unless ($FORM{$check})
{
print "Content-type: text/html\n\n";
print "<html>\n<head>\n<title>Missing Information</title>\n</head>\n";
print "<body bgcolor=\"#000000\" text=\"#FFFFFF\">\n<div align=\"center\">\n";
print "<h2>Missing Information</h2><hr>\n";
print "<STRONG>Sorry, please fill out the $check field. Go back and try again.</STRONG>\n</div>\n";
print "</body>\n</html>\n";
exit;
}
}

# Check the users email
if ($FORM{'myemail'})
{
unless ($FORM{'myemail'} =~ /\w+@\w+.\w+/)
{
print "Content-type: text/html\n\n";
print "<html>\n<head>\n<title>Bad E-mail</title>\n</head>\n";
print "<body bgcolor=\"#000000\" text=\"#FFFFFF\">\n<div align=\"center\">\n";
print "<h2>Bad E-mail</h2><hr>\n<STRONG>The e-mail address that the user of this \n";
print "script entered is invalid. Please contact them.</strong>\n";
print "</div>\n</body>\n</html>";
exit;
}
}

# Check the senders email
if ($FORM{'email'})
{
unless ($FORM{'email'} =~ /\w+@\w+.\w+/)
{
print "Content-type: text/html\n\n";
print "<html>\n<head>\n<title>Bad E-mail</title>\n</head>\n";
print "<body bgcolor=\"#000000\" text=\"#FFFFFF\">\n<div align=\"center\">\n";
print "<h2>Bad E-mail</h2><hr>\n<STRONG>The e-mail address that you've\n";
print "entered, $FORM{'email'}, is invalid. How would I ever contact you? Go back and try again.</STRONG>\n";
print "</div>\n</body>\n</html>";
exit;
}
}

# Send me the email
open (MAIL,"|$mailprogram -t");
print MAIL "To: $myemail\n";
print MAIL "From: <$FORM{'email'}> $FORM{'name'}\n";
print MAIL "Subject: $FORM{'subject'}\n\n";
foreach $line ($FORM{'info'})
{
print MAIL "$line";
}
print MAIL "\n\n--\n$FORM{'name'}\n";
print MAIL "$FORM{'phone'}";
close MAIL;

# Send user an autoresponse.
if ($auto_response =~ /True/i && $FORM{'email'})
{
open (MAIL,"|$mailprogram -t");
print MAIL "To: $FORM{'name'} <$FORM{'email'}>\n";
print MAIL "From: $myemail\n";
print MAIL "Subject: Re: $FORM{'subject'}\n\n";
print MAIL "This is an autoresponse notifying you that your email has indeed been received. I shall be contacting you shotly.\n\n";
foreach $line ($FORM{'info'})
{
print MAIL ">$line";
}
close MAIL;
}

# Print thank you message to the user.
print "Content-type: text/html\n\n";
print "<html>\n<head>\n<title>Thank you!</title>\n</head>\n";
print "<body bgcolor=\"#000000\" text=\"#FFFFFF\">\n";
print "<div align=\"center\"><h2>Thank you!</h2><hr>\n<STRONG>I have received your information \n";
print "and will get back to you asap.\n";
if ($auto_response =~ /True/i && $FORM{'email'})
{
print "You should receive an autoresponse shortly.<p>\n";
}
print "</STRONG></div>\n</body>\n</html>";

Скрипт могу выслать на мыло.
Спасибо.

Создать новую тему   Часовой пояс GMT +4, время: 06:06.
Быстрый переход
  « Предыдущая тема | Следующая тема »  
Опции темы
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.


 


Часовой пояс GMT +4, время: 06:06.


Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.