Добро пожаловать,
Гость
. Пожалуйста,
войдите
или
зарегистрируйтесь
.
Не получили
письмо с кодом активации
?
1 час
1 день
1 неделя
1 месяц
Навсегда
Новости:
Начало
Помощь
Поиск
Календарь
Вход
Регистрация
Forum Webscript.Ru
»
Программирование
»
Perl
»
скрипт не отправляет почту MIME::lite
« предыдущая тема
следующая тема »
Печать
Страницы: [
1
]
Вниз
Автор
Тема: скрипт не отправляет почту MIME::lite (Прочитано 2209 раз)
0 Пользователей и 1 Гость просматривают эту тему.
systemroot
Завсегдатай
Пользователь
Сообщений: 50
+0/-0
0
скрипт не отправляет почту MIME::lite
«
:
07 Апреля 2005, 11:52:22 »
есть скрипт который выводит форму предлагает ввести адрес и опиание и по нажатии на кнопку должен отправлять письмо но он повисает на отправке письма....
#!/usr/local/bin/perl
use
Mysql
;
use
Time
::
Local
;
$curtime
=
time
();
(
$sec
,
$min
,
$hour
,
$mday
,
$mon
,
$year
,
$wday
,
$yday
,
$isdst
) =
localtime
(
$curtime
);
$Day
=
"0"
.(
$mday
);
$Day
=
substr
(
$Day
, -
2
,
2
);
$Month
=
"0"
.(
1
+
$mon
);
$Month
=
substr
(
$Month
, -
2
,
2
);
$Year
=(
1900
+
$year
);
$SDate
=
$Year
.
"-"
.
$Month
.
"-"
.
$Day
;
@
MonthNames
= (
"Jan"
,
"Feb"
,
"Mar"
,
"Apr"
,
"May"
,
"Jun"
,
"Jul"
,
"Aug"
,
"Sep"
,
"Oct"
,
"Nov"
,
"Dec"
);
$dbh
=
Mysql
->
connect
(
"localhost"
,
"tpp"
,
"tpp"
,
"nt[gjllth;rf"
);
if (!
defined
(
$dbh
))
{
exit
255
;
}
print
"Content-type: text/html\\n\\n"
;
print <<
M1
;
<
html
>
<
head
>
<
meta http
-
equiv
=
"Content-Type"
content
=
"text/html; charset=koi8-r"
>
<
title
>
IPTel Statistic
</
title
>
</
head
><
body bgcolor
=
"#D3D3D3"
>
M1
;
$Params
{
CallID
}=
""
;
$Params
{
Destination
}=
""
;
$Params
{
DestinationID
}=
""
;
$Params
{
EmailID
}=
""
;
$Query
=
$ENV
{
QUERY_STRING
};
@
pairs
=
split
(/&/,
$Query
);
foreach
$Pair
(@
pairs
)
{
if (
$Pair
=~ /(.+)=(.*)/)
{
# $Value = $dbh->quote($2);
$Key
= $
1
;
$Value
= $
2
;
$Params
{
$Key
} =
$Value
;
}
}
print
"<TABLE width=\\"
100
%\\
"><TR><TD><H1>
$Params
{OperatorName}\\t"
;
print
"
$Params
{Operator}</H1></TD>\\n"
;
print
"<form action=\\"
ipoperator
.
pl
\\
" method=\\"
GET
\\
">\\n"
;
print
"<input type=\\"
hidden
\\
" name=\\"
Operator
\\
" value=\\"
$Params
{
Operator
}\\
">\\n"
;
print
"<input type=\\"
hidden
\\
" name=\\"
OperatorName
\\
" value=\\"
$Params
{
OperatorName
}\\
">\\n"
;
print
"<input type=\\"
hidden
\\
" name=\\"
Destination
\\
" value=\\"
Out
\\
">\\n"
;
print
"<TD align=\\"
right
\\
" valign=\\"
middle
\\
">Отключить <input type=\\"
SUBMIT
\\
" style=\\"
width
:
100px
;
height
:
30px
;\\
" name=\\"
B2
\\
""
;
print
" value=\\"
$Params
{
Operator
}\\
"></TD></TR></form></TABLE>\\n"
;
if(
$Params
{
EmailID
} !=
""
)
{
$querystr
=
"Select Email From Contacts where Id=\\"
$Params
{
EmailID
}\\
""
;
my $sth
=
$dbh
->
query
(
$querystr
) or die
$Mysql
::
db_errstr
;
if (!
defined
(
$sth
))
{ exit
1
; }
%
Email
=
$sth
->
fetchhash
;
require
MIME
::
Lite
;
$msg
=
MIME
::
Lite
->
new
(
From
=>\
'tpp@company.utk.ru\',
To =>$Email{Email},
Subject =>\'Тех поддержка\',
Type => \'multipart/related\');
$msg->attach(
Type =>\'text/plain; charset=KOI8-R\',
Data =>\'Тип проблемы: \'.$Params{Problem}.\'\\n Описание проблемы:\'. $Params{Description}.\' \\n
Дата:\'. $SDate
);
$msg->send(\'smtp\', \'212.220.44.254\', Timeout=>60);
}
if($Params{Email} ne "" )
{
require MIME::Lite;
$msg = MIME::Lite->new(
From =>\'tpp@company.utk.ru\',
To =>$Params{Email},
Subject =>\'Тех поддержка\',
Type => \'multipart/related\');
$msg->attach(
Type =>\'text/plain; charset=KOI8-R\',
Data =>\'Тип проблемы: \'.$Params{Problem}.\'\\n Описание проблемы:\'. $Params{Description}.\' \\n
Дата:\'. $SDate
);
$msg->send(\'smtp\', \'212.220.44.254\', Timeout=>60);
}
print "<form name=\\"callprop\\" action=\\"test.pl\\" method=\\"GET\\">\\n";
print "<table>\\n";
print "<tr>\\n";
print "<td>\\n";
print "<input type=\\"hidden\\" name=\\"Operator\\" value=\\"$Params{Operator}\\">\\n";
print "<input type=\\"hidden\\" name=\\"OperatorName\\" value=\\"$Params{OperatorName}\\">\\n";
print "<input type=\\"hidden\\" name=\\"CallID\\" value=\\"$Params{CallID}\\">\\n";
print "Номер назначения из списка:<select name=\\"DestinationID\\">";
$querystr="Select * from Contacts where type=\\"Phone\\" OR type=\\"all\\" ";
my $sth=$dbh->query($querystr) or die $Mysql::db_errstr;
if (!defined($sth))
{ exit 255; }
while (%arr = $sth->fetchhash)
{
if ($Params{DestinationID}==$arr{Id}) {
print "<option selected value=\'$arr{Id}\'>$arr{Phone} $arr{DataText}</option>";
}else {
print "<option value=\'$arr{Id}\'>$arr{Phone} $arr{DataText}</option>";
}
}
print "</select>
\\n";
print "Номер назначения:<input type=\\"text\\" name=\\"Destination\\" value=\\"$Params{Destination}\\">
\\n";
print "<input type=\\"SUBMIT\\" name=\\"B1\\" value=\\"Send\\"></p>
\\n";
print "</td>\\n";
print "<td>\\n";
print "E-Mail из списка: <select name=\\"EmailID\\">";
$querystr="Select * from Contacts where type=\\"email\\" OR type=\\"all\\"";
my $sth=$dbh->query($querystr) or die $Mysql::db_errstr;
while (%arr = $sth->fetchhash)
{
if ($Params{DestinationID}==$arr{Id}) {
print "<option selected value=\'$arr{Id}\'>$arr{Email} $arr{DataText}</option>";
}else {
print "<option value=\'$arr{Id}\'>$arr{Email} $arr{DataText}</option>";
}
}
print "</select>
\\n";
print "E-Mail: <input tupe=\\"text\\" name=\\"Email\\" value=\\"\\">
";
print "Категория звонка : <select name=category onchange=\\"update(this.selectedIndex)\\">";
$querystr="Select * from Categories";
my $sth=$dbh->query($querystr) or die $Mysql::db_errstr;
if (!defined($sth))
{ exit 255; }
while (%arr = $sth->fetchhash)
{
print "<option value=\'$arr{id}\'>$arr{Category}</option>";
}
print "</select>
";
print "Тип проблемы :
<select name=\\"problem\\">\\n";
print "</select>
";
print "Описание проблемы:
<textarea cols=40 rows=15 name=\\"Description\\"></textarea>";
print "</td>\\n";
print "</tr>\\n";
print "</table>\\n";
print "</form>\\n";
print <<M1;
<script type="text/javascript">
<!--
M1
;
$querystr="select * from Categories";
my $sth=$dbh->query($querystr) or die $Mysql::db_errstr;
if (!defined($sth))
{ exit 1; }
print "var cities=new Array()\\n";
$i=0;
while (%Categories = $sth->fetchhash) {
$Categor[$i]=$Categories{id};
$i++;
}
for ($j=0; $j<$i;$j++) {
$querystr="select * from Cause where CategoryID=\\"$Categor[$j]\\"";
my $sth=$dbh->query($querystr) or die $Mysql::db_errstr;
if (!defined($sth))
{ exit 1; }
print "cities[$j]=";
%prob=$sth->fetchhash;
print "[\\"$Categor[$j]|$prob{CauseID}|$prob{CauseText}\\"";
while (%prob=$sth->fetchhash) {
print ",\\"$Categor[$j]|$prob{CauseID}|$prob{CauseText}\\"";
}
print "] \\n";
}
print <<M2;
var countrieslist=document.callprop.category
var citieslist=document.callprop.problem
function update(selectedcitygroup){
citieslist.options.length=0
for (i=0; i<cities[selectedcitygroup].length; i++)
citieslist.options[citieslist.options.length]=new Option(cities[selectedcitygroup][i].split("|")[2], cities[selectedcitygroup][i].split("|")[1])
}
//-->
</script>
M2
;
Записан
ICQ : 334278725
mail: olegssm@timus.ru olegssm@mail.ru
Печать
Страницы: [
1
]
Вверх
« предыдущая тема
следующая тема »
Forum Webscript.Ru
»
Программирование
»
Perl
»
скрипт не отправляет почту MIME::lite
Sitemap
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