Автор Тема: CGI, Perl, Sendmail => письма приходят не на все E-mail\'ы  (Прочитано 6628 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн sd1074

  • Завсегдатай
  • Новичок
  • *
  • Сообщений: 40
  • +0/-0
  • 0
    • Просмотр профиля
    • http://
Отправляю письма с помощью sendmail. В строке адреса пишу: "login1\\@yandex.ru, login2\\@mail.ru, login3\\@yandex.ru, login4\\@gmail.com", однако письма стабильно приходят только на яндексовские мылы. Ни на mail, ни на gmail не приходит ничего. Аккуанты рабочие. Отправляю с бесплатного хостинга holm.ru. Как такое может быть?
« Последнее редактирование: 19 Марта 2007, 12:48:42 от sd1074 »

Оффлайн NeoNox

  • Координатор
  • Глобальный модератор
  • Ветеран
  • *****
  • Сообщений: 3012
  • +0/-0
  • 0
    • Просмотр профиля
В локальные блэклисты попали. Посмотри в папочке СПАМ на gmail.com.
The documentations is your friend

Оффлайн sd1074

  • Завсегдатай
  • Новичок
  • *
  • Сообщений: 40
  • +0/-0
  • 0
    • Просмотр профиля
    • http://
Прошу прощения за свою неграмотность, но сразу возникло несколько вопросов:
1. Облазил gmail.com и не нашёл блэк листы . английский мой медленный. Может быть подскажете?
2. А что именно попадает в блэклисты? ну то есть IP там мой или сервера, может быть что-то другое.
3. Как такое могло произойти, если ничего плохого я не делал. никаких больших рассылок и т.п... может это holm у них в опале?

Оффлайн NeoNox

  • Координатор
  • Глобальный модератор
  • Ветеран
  • *****
  • Сообщений: 3012
  • +0/-0
  • 0
    • Просмотр профиля
запросто всю сеть ИСП провайдера могли прикрыть, такие нынче времена.
Теперь о понимании в сути проблемы:
Используете Net::SMTP Модуль с включенным Debug=>1 флагом. Отпровляете из консоли и видите что-то типа этого
Цитировать
Net::SMTP>>> Net::SMTP(2.29)
Net::SMTP>>>   Net::Cmd(2.26)
Net::SMTP>>>     Exporter(5.58)
Net::SMTP>>>   IO::Socket::INET(1.29)
Net::SMTP>>>     IO::Socket(1.29)
Net::SMTP>>>       IO::Handle(1.25)
Net::SMTP=GLOB(0x791710)<<< 220-rly-mb05.mail.aol.com ESMTP mail_relay_in-mb5.8; Mon, 19 Mar 2007 06:44:41 -0400
Net::SMTP=GLOB(0x791710)<<< 220-America Online (AOL) and its affiliated companies do not
Net::SMTP=GLOB(0x791710)<<< 220-     authorize the use of its proprietary computers and computer
Net::SMTP=GLOB(0x791710)<<< 220-     networks to accept, transmit, or distribute unsolicited bulk
Net::SMTP=GLOB(0x791710)<<< 220-     e-mail sent from the internet.  Effective immediately:  AOL
Net::SMTP=GLOB(0x791710)<<< 220-     may no longer accept connections from IP addresses which
Net::SMTP=GLOB(0x791710)<<< 220      have no reverse-DNS (PTR record) assigned.
Net::SMTP=GLOB(0x791710)>>> EHLO smtp.com
Net::SMTP=GLOB(0x791710)<<< 250-rly-mb05.mail.aol.com xxx.com
Net::SMTP=GLOB(0x791710)<<< 250 HELP
Net::SMTP=GLOB(0x791710)>>> MAIL FROM:
Net::SMTP=GLOB(0x791710)<<< 250 OK
Net::SMTP=GLOB(0x791710)>>> RCPT TO:
Net::SMTP=GLOB(0x791710)<<< 250 OK
Net::SMTP=GLOB(0x791710)>>> DATA
Net::SMTP=GLOB(0x791710)<<< 354 START MAIL INPUT, END WITH "." ON A LINE BY ITSELF
Net::SMTP=GLOB(0x791710)>>> To: postmaster@aol.com
Net::SMTP=GLOB(0x791710)>>> From: xxx@xxx.com
Net::SMTP=GLOB(0x791710)>>> A simple test message
Net::SMTP=GLOB(0x791710)>>> .
Net::SMTP=GLOB(0x791710)<<< 250 OK
Net::SMTP=GLOB(0x791710)>>> QUIT
Net::SMTP=GLOB(0x791710)<<< 221 SERVICE CLOSING CHANNEL

В данном случае
Net::SMTP=GLOB(0x791710)<<< 250 OK
Если получаете не 2хх, значит читайте что за ошибку сервер вернул.
« Последнее редактирование: 19 Марта 2007, 18:23:55 от NeoNox »
The documentations is your friend

Оффлайн sd1074

  • Завсегдатай
  • Новичок
  • *
  • Сообщений: 40
  • +0/-0
  • 0
    • Просмотр профиля
    • http://
спасибо, вы мне льстите :-). я пока ламер в перл. вот даж с сендмэйлом до конца не справился :). До Net::SMTP ещё не добрался

Оффлайн NeoNox

  • Координатор
  • Глобальный модератор
  • Ветеран
  • *****
  • Сообщений: 3012
  • +0/-0
  • 0
    • Просмотр профиля
Я никому не льщу, и слово ламер здесь не помогает. Модуль Net::SMTP прост как угол дома, пять минут потрать на документацию, и все вопросы отпадут сами собой. Примеры нужны?
The documentations is your friend

Оффлайн sd1074

  • Завсегдатай
  • Новичок
  • *
  • Сообщений: 40
  • +0/-0
  • 0
    • Просмотр профиля
    • http://
Да, если не затруднит :)

Оффлайн NeoNox

  • Координатор
  • Глобальный модератор
  • Ветеран
  • *****
  • Сообщений: 3012
  • +0/-0
  • 0
    • Просмотр профиля
вот простой пример
use Net::SMTP;                                # Подключаем модуль.
$smtp Net::SMTP->new(\'holm.ru\', Hello =>\'holm.ru\', Debug=>1 );       # Указываем SMTP сервер,  Hello и включаем дебаг.
   
$smtp->mail(\'vasya@holm.ru\');                 # Указываем от кого письмо.
$smtp->to(\'pm@holm.ru\');                     # Указываем кому письмо.
   
$smtp->data();                                # Начинаем посылку данных
$smtp->datasend("To: pm\\@holm.ru \\n");
$smtp->datasend("From: vasya\\@holm.ru \\n");
# Указываем информацию для поля "Кому" и "От Кого"
$smtp->datasend("\\n");                        # Пустая строка
$smtp->datasend("test messagen");            # Сообщение
$smtp->dataend();                             # Заканчиваем посылку даных
   
$smtp->quit;                                  # Закрываем соединение

запускаем с консоли и смотрим что скрипт выдает
The documentations is your friend

Оффлайн sd1074

  • Завсегдатай
  • Новичок
  • *
  • Сообщений: 40
  • +0/-0
  • 0
    • Просмотр профиля
    • http://
спасибо!

Оффлайн frank258

  • Заглянувший
  • Новичок
  • *
  • Сообщений: 6
  • +0/-0
  • 0
    • Просмотр профиля
    • http://www.fx-trader.ru
CGI, Perl, Sendmail => письма приходят не на все E-mail\'ы
« Ответ #9 : 10 Апреля 2007, 21:00:08 »
Здравствуйте

Помогите решить проблему - есть на сайте форма для отправки сообщений, обрабатывает ее скрипт на perl, но в тексте приходящих с сайта сообщений  русские буквы не отображаются, нормально отправляется только латиница. Подскажите, где в скрипте что нужно исправить. к сожалению весь скрипт не влез.

#!/usr/bin/perl
##############################################################################
# FormMail                        Version 1.92                               #
# Copyright 1995-2002 Matt Wright mattw@scriptarchive.com                    #
# Created 06/09/95                Last Modified 04/21/02                     #
# Matt\'s Script Archive, Inc.:    http://www.scriptarchive.com/              #
##############################################################################
#----------------------------------------------------------------------------#
###############################--ПЕРЕВОД--####################################
#                                #
# Copyright 2002 Anatoliy Sergeevich                    #
# http://HTTP://anatoliy.studio-pegas.com     #
# E-MAIL: anatoliy@studio-pegas.com                     #
#                                #
##############################################################################
#----------------------------------------------------------------------------#
#         ТУТ НУЖНО ИЗМЕНИТЬ ПАРАМЕТРЫ              #
#----------------------------------------------------------------------------#
##############################################################################
# Путь к sendmail
# Обычно это: /usr/sbin/sendmail
# НЕ УДАЛЯЙТЕ "-i -t"

$mailprog = \'/usr/sbin/sendmail -i -t\';

#  Эта переменная определяет сервера с которых скрипт будет
# работать. Защищает Вас от несанкционированного доступа к скрипту.
# Если Вы хотите что бы скрипт можно было использовать с других серверов
# надо их здесь указать. ТАК ЖЕ НАДО ОБЯХАТЕЛЬНО УКАЗЫВАТЬ ХОСТ АДРЕС ВАШЕГО E-MAIL ПРОВАЙДЕРА.
# ЕСЛИ У ВАС ТАКОЙ АДРЕС: email@your.host.com, ТО НАДО ПРОПИСАТЬ ЭТО: your.host.com, ЕСЛИ  # email@mail.ru, то mail.ru

@referers = (\'mail.ru\');

# Done                                                                       #
##############################################################################
#----------------------------------------------------------------------------#
#         ДАЛЕЕ ИЗМЕНЯТЬ СКРИПТ НЕ НУЖНО!!!           #
#----------------------------------------------------------------------------#
##############################################################################
# Done                                                                       #

@recipients = &fill_recipients(@referers);

@valid_ENV = (\'REMOTE_HOST\',\'REMOTE_ADDR\',\'REMOTE_USER\',\'HTTP_USER_AGENT\');


# Check Referring URL
&check_url;

# Retrieve Date
&get_date;

# Parse Form Contents
&parse_form;

# Check Required Fields
&check_required;

# Send E-Mail
&send_mail;

# Return HTML Page or Redirect User
&return_html;

# NOTE rev1.91: This function is no longer intended to stop abuse, that      #
#    functionality is now embedded in the checks made on @recipients and the #
#    recipient form field.                                                   #

sub check_url {

    # Localize the check_referer flag which determines if user is valid.     #
    local($check_referer) = 0;

    # If a referring URL was specified, for each valid referer, make sure    #
    # that a valid referring URL was passed to FormMail.                     #

    if ($ENV{\'HTTP_REFERER\'}) {
        foreach $referer (@referers) {
            if ($ENV{\'HTTP_REFERER\'} =~ m|https?://([^/]*)$referer|i) {
                $check_referer = 1;
                last;
            }
        }
    }
    else {
        $check_referer = 1;
    }

    # If the HTTP_REFERER was invalid, send back an error.                   #
    if ($check_referer != 1) { &error(\'bad_referer\') }
}

sub get_date {

    # Define arrays for the day of the week and month of the year.           #
    @days   = (\'Воскресенье\',\'Понедельник\',\'Вторник\',\'Среду\',
               \'Четверг\',\'Пятницу\',\'Субботу\');
    @months = (\'Января\',\'Февраля\',\'Марта\',\'Апреля\',\'Мая\',\'Июня\',\'Июля\',
               \'Августа\',\'Сентября\',\'Октября\',\'Ноября\',\'Декабря\');

    # Get the current time and format the hour, minutes and seconds.  Add    #
    # 1900 to the year to get the full 4 digit year.                         #
    ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6];
    $time = sprintf("%02d:%02d:%02d",$hour,$min,$sec);
    $year += 1900;

    # Format the date.                                                       #
    $date = "$days[$wday], $mday $months[$mon] $year года,  в $time - по Моск.";

}

sub parse_form {

    # Define the configuration associative array.                            #
    %Config = (\'recipient\',\'\',          \'subject\',\'\',
               \'email\',\'\',              \'realname\',\'\',
               \'redirect\',\'\',           \'bgcolor\',\'\',
               \'background\',\'\',         \'link_color\',\'\',
               \'vlink_color\',\'\',        \'text_color\',\'\',
               \'alink_color\',\'\',        \'title\',\'\',
               \'sort\',\'\',               \'print_config\',\'\',
               \'required\',\'\',           \'env_report\',\'\',
               \'return_link_title\',\'\',  \'return_link_url\',\'\',
               \'print_blank_fields\',\'\', \'missing_fields_redirect\',\'\');

    # Determine the form\'s REQUEST_METHOD (GET or POST) and split the form   #
    # fields up into their name-value pairs.  If the REQUEST_METHOD was      #
    # not GET or POST, send an error.                                        #

    if ($ENV{\'REQUEST_METHOD\'} eq \'GET\') {

        # Split the name-value pairs
        @pairs = split(/&/, $ENV{\'QUERY_STRING\'});
    }
    elsif ($ENV{\'REQUEST_METHOD\'} eq \'POST\') {

        # Get the input
        read(STDIN, $buffer, $ENV{\'CONTENT_LENGTH\'});
 
        # Split the name-value pairs
        @pairs = split(/&/, $buffer);
    }
    else {
        &error(\'request_method\');
    }

    # For each name-value pair:                                              #
    foreach $pair (@pairs) {

        # Split the pair up into individual variables.                       #
        local($name, $value) = split(/=/, $pair);
 
        # Decode the form encoding on the name and value variables.          #
        # v1.92: remove null bytes                                           #
        $name =~ tr/+/ /;
        $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
        $name =~ tr/\\0//d;

        $value =~ tr/+/ /;
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
        $value =~ tr/\\0//d;

        # If the field name has been specified in the %Config array, it will #
        # return a 1 for defined($Config{$name}}) and we should associate    #
        # this value with the appropriate configuration variable.  If this   #
        # is not a configuration form field, put it into the associative     #
        # array %Form, appending the value with a \', \' if there is already a #
        # value present.  We also save the order of the form fields in the   #
        # @Field_Order array so we can use this order for the generic sort.  #

        if (defined($Config{$name})) {
            $Config{$name} = $value;
        }
        else {
            if ($Form{$name} ne \'\') {
                $Form{$name} = "$Form{$name}, $value";
            }
            else {
                push(@Field_Order,$name);
                $Form{$name} = $value;
            }
        }
    }

    # The next six lines remove any extra spaces or new lines from the       #
    # configuration variables, which may have been caused if your editor     #
    # wraps lines after a certain length or if you used spaces between field #
    # names or environment variables.                                        #

    $Config{\'required\'} =~ s/(\\s+|\\n)?,(\\s+|\\n)?/,/g;
    $Config{\'required\'} =~ s/(\\s+)?\\n+(\\s+)?//g;
    $Config{\'env_report\'} =~ s/(\\s+|\\n)?,(\\s+|\\n)?/,/g;
    $Config{\'env_report\'} =~ s/(\\s+)?\\n+(\\s+)?//g;
    $Config{\'print_config\'} =~ s/(\\s+|\\n)?,(\\s+|\\n)?/,/g;
    $Config{\'print_config\'} =~ s/(\\s+)?\\n+(\\s+)?//g;

    # Split the configuration variables into individual field names.         #

    @Required = split(/,/,$Config{\'required\'});
    @Env_Report = split(/,/,$Config{\'env_report\'});
    @Print_Config = split(/,/,$Config{\'print_config\'});

    # ACCESS CONTROL FIX: Only allow ENV variables in @valid_ENV in          #
    # @Env_Report for security reasons.                                      #

    foreach $env_item (@Env_Report) {
        foreach $valid_item (@valid_ENV) {
            if ( $env_item eq $valid_item ) { push(@temp_array, $env_item) }
        }
    }
    @Env_Report = @temp_array;
}

sub check_required {

    # Localize the variables used in this subroutine.                        #

    local($require, @error);

    # The following insures that there were no newlines in any fields which  #
    # will be used in the header.                                            #

    if ($Config{\'subject\'} =~ /(\\n|\\r)/m || $Config{\'email\'} =~ /(\\n|\\r)/m ||
        $Config{\'realname\'} =~ /(\\n|\\r)/m || $Config{\'recipient\'} =~ /

 

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