Link to home
Start Free TrialLog in
Avatar of ijk111
ijk111

asked on

unknown sender postfix

I run postfix.
A lot of the mail I send out ends up in the bulk mail folders. Reason being for some reason when the mail arrives

[b](unknown sender)[/b] to me
To:(E-Mail address )
Date: 10-Dec-2006 19:56
Subject: hello there !!!


it arrives from [b]UNKNOWN SENDER[/b] and such messages are either filtered out or sent to the bulk mail folder.

Have run DNS Report which is fine including the reverese ptr address.
The php script itself is fine as when I send mail from my backup box on a separate windows xp computer with localhost set up on it using argosoft mail server the sender is clearly set up.

so it seems to be a problem with postfix and have throughly read and reread all the instructions and all seems ok.

when i run this command
> telnet relay-check.mail-abuse.org
relay-check.mail-abuse.org: hostname nor servname provided, or not known

I use the ipfw firewall. follow this link to see my firewall setting
(URL address blocked: See forum rules)=45174

What do i need to do so that when I send mail it does not arrive from UNKNOW SENDER


just tested telnet after disabling the ipfw firewall and still get the same response below

> telnet relay-check.mail-abuse.org
relay-check.mail-abuse.org: hostname nor servname provided, or not known

so must be something else

Runing freebsd 5.4

my hosts file

::1               localhost.myservername.com localhost
127.0.0.1          localhost.myservername.com localhost
ipaddress one          D9483.myservername.com D9483
ipaddress one          D9483.myservername.com.
ipaddress two  D9483.myservername.com D9483
ipaddress two  D9483.myservername.com.
ipaddress three    D9483.myservername.com D9483
ipaddress three    D9483.myservername.com.
ipaddress four    D9483.myservername.com D9483
ipaddress four    D9483.myservername.com.


my host.conf file

hosts
bind
# We have machines with multiple IP addresses.
multi on
# Check for IP address spoofing.
nospoof on



my resolv.conf file

nameserver ipaddress one
nameserver ipaddress two
nameserver ipaddress three
nameserver ipaddress four
search domainname1.com domainname2.com domainname3.com domainname4.co.uk domainname5.com domainname6.com domainname7.co.uk domainname8.co.uk domainname9.co.uk domainname10.com



main.cf file for postfix
soft_bounce = yes
command_directory = /pathto/sbin
daemon_directory = /pathto/libexec/postfix
$myhostname = d8567.myservername.com
$mydomain = myservername.com
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, /pathto/etc/postfix/mydestination
unknown_local_recipient_reject_code = 550


mynetworks = 127.0.0.0/8
#ADDED BY ME
virtual_mailbox_domains = abc.com, domain3.com, domain.co.uk
virtual_mailbox_base = /pathto/etc/postfix/vhosts
virtual_mailbox_maps = hash:/pathto/sbin/vmailbox
virtual_minimum_uid = 100
virtual_uid_maps = static:125
virtual_gid_maps = static:125
virtual_alias_maps = hash:/pathto/etc/postfix/virtual

debug_peer_level = 2

debugger_command =
       PATH=/bin:/usr/bin:/pathto/bin:/usr/X11R6/bin
       xxgdb $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /pathto/sbin/sendmail
newaliases_path = /pathto/bin/newaliases

mailq_path = /pathto/bin/mailq
setgid_group = maildrop

html_directory = no

manpage_directory = /pathto/man

# sample_directory: The location of the Postfix sample configuration files.
# This parameter is obsolete as of Postfix 2.1.
#
sample_directory = /pathto/etc/postfix

# readme_directory: The location of the Postfix README files.
#
readme_directory = no
virtual_alias_domains = domain.co.uk abc.com domain3.com
virtual_alias_maps = hash:/pathto/etc/postfix/virtual


empty_address_recipient = abc@gmail.com

virtual_maps = hash:/pathto/etc/postfix/virtual_maps
Avatar of Arty K
Arty K
Flag of Kazakhstan image

First I recommend you to change

empty_address_recipient = abc@gmail.com
to
empty_address_recipient = MAILER-DAEMON

and then restart postfix and see  what hapens.
Avatar of ijk111
ijk111

ASKER

Thank you for your response had almost given up.

Have done the above makes no different.

(unknown sender) to me
 More options        10:30 (3 minutes ago)
Content-type: text/html; charset=iso-8859-1

still get the unknow sender thing
Do you mind posting the php script?
Avatar of ijk111

ASKER

There are a few php files which sent out the emails. One of them is given below.

<?

require_once( "inc/header.inc.php" );
require_once( "{$dir['inc']}db.inc.php" );
require_once( "{$dir['inc']}design.inc.php" );
require_once( "{$dir['inc']}profiles.inc.php" );

// --------------- page variables

$_page['name_index'] = 501;

$logged['member'] = member_auth(0, false);

$_page['header'] = _t("_Send virtual kiss");

// --------------- page components

$_ni = $_page['name_index'];
$_page_cont[$_ni]['page_main_code'] = PageCompPageMainCode();

// --------------- [END] page components

PageCode();

// --------------- page components functions

/**
 * page code function
 */
function PageCompPageMainCode()
{
    global $content_w;
      global $_page;

      $ret = "";

      $member['ID'] = (int)$_COOKIE['memberID'];
      $member['Password'] = $_COOKIE['memberPassword'];
      $recipientID = getID( $_REQUEST['sendto'], 0 );
      $recipient = db_arr( "SELECT * FROM `Profiles` WHERE `ID` = ". $recipientID );
      $contact_allowed = contact_allowed($member['ID'], $recipientID);

      if ( $_REQUEST['ConfCode'] && $_REQUEST['from'] && 
            ( strcmp( $_REQUEST['ConfCode'], base64_encode( base64_encode( crypt( $_REQUEST['from'], "vkiss_secret_string" ) ) ) ) == 0 ) )
      {
            $member['ID'] = (int)$_REQUEST['from'];
      }

      //
      // Check if member can send messages
      $check_res = checkAction( $member['ID'], ACTION_ID_SEND_VKISS );
      if ( $check_res[CHECK_ACTION_RESULT] != CHECK_ACTION_RESULT_ALLOWED
            && !$contact_allowed )
      {
            $_page['header_text'] = _t("_Send virtual kiss3");
            $ret = "
                  <table width=\"". ($content_w - 40) ."\" cellpadding=\"4\" cellspacing=\"4\" border=\"0\">
                        <tr>
                              <td align=center class=text2>". $check_res[CHECK_ACTION_MESSAGE] ."</td>
                        </tr>
                  </table>\n";
            return $ret;
      }

      $action_result = "";

      // Check if recipient found
      if( !$recipient )
      {
            $_page['header_text'] = _t("_Send virtual kiss3");
            $ret = "
                  <table width=\"". ($content_w - 40) ."\" cellpadding=\"4\" cellspacing=\"4\">
                        <tr>
                              <td align=center class=text2>
                                    <form method=\"GET\" action=\"vkiss.php\">
                                          <input class=no size=15 type=\"text\" name=\"sendto\">&nbsp;<input class=no type=\"submit\" value=\"". _t("_Send kiss") ."!\">
                                    </form>
                              </td>
                        </tr>
                  </table>\n";
            return $ret;
      }

      // Perform sending
      $send_result = MemberSendVKiss( $member, $recipient );
      switch ( $send_result )
      {
            case 1:
                  $action_result .= _t_err( "_VKISS_BAD" );
                  break;
            case 7:
                  $action_result .= _t_err( "_VKISS_BAD_COUSE_B" );
                  break;
            case 10:
                  $action_result .= _t_err( "_VKISS_BAD_COUSE_C" );
                  break;
            case 13:
                  $action_result .= _t_err( "_VKISS_BAD_COUSE_A3" );
                  break;
            case 23:
                  $action_result .= _t_err( "_VKISS_BAD_COUSE_X" );
                  break;
            case 24:
                  $action_result .= _t_err( "_VKISS_BAD_COUSE_Y" );
                  break;
            default:
                  $action_result .= _t( "_VKISS_OK" );
                  break;
      }
      if ( $send_result == 0 )
            $_page['header_text'] = _t("_Send virtual kiss2");
      else
            $_page['header_text'] = _t("_Send virtual kiss3");

      $ret = "
            <table width=\"". ($content_w - 40) ."\" cellpadding=\"4\" cellspacing=\"4\">
                  <tr>
                        <td align=center class=text2>
                              {$action_result}<br>
                        </td>
                  </tr>
            </table>\n";
      return $ret;
}

/**
 * Send virtual kiss
 */
function MemberSendVKiss( $member, $recipient )
{
      global $site;

      // Check if recipient is active
      if ( !db_arr( "SELECT `ID` FROM `Profiles` WHERE `ID` = {$recipient['ID']} AND `Status` = 'Active'", 0 ) )
      {
            return 7;
      }

      // block members
      if ( db_arr( "SELECT `ID`, `Profile` FROM `BlockList` WHERE `ID` = {$recipient['ID']} AND `Profile` = {$member['ID']}", 0 ) )
      {
            return 24;
      }

      // Get sender info
      $sender = db_arr( "SELECT * FROM `Profiles` WHERE `ID` = {$member['ID']}" );

      // Send email notification
      $message      = getParam( "t_VKiss" );
      $subject      = getParam('t_VKiss_subject');

      $headers      = "From: {$site['title']} <{$site['email_notify']}>";
      $headers2      = "-f{$site['email_notify']}";
      $ConfCode      = urlencode( base64_encode( base64_encode( crypt( $recipient['ID'], "vkiss_secret_string" ) ) ) );

      $message      = str_replace( "<SiteName>", $site['title'], $message );
      $message      = str_replace( "<Domain>", $site['url'], $message );
      $message      = str_replace( "<YourRealName>", $recipient['RealName'], $message );
      $message      = str_replace( "<NickName>", ($sender ? $sender['NickName'] : _t("_Visitor") ), $message );
      $message      = str_replace( "<StrID>", $member['ID'], $message );
      $message      = str_replace( "<ID>", $member['ID'], $message );
      $message      = str_replace( "<ConfCode>", $ConfCode, $message );
      $message      = str_replace( "<VKissLink>", ($sender ? "<a href=\"{$site['url']}vkiss.php?sendto={$member['ID']}&from={$recipient['ID']}&ConfCode={$ConfCode}\">{$site['url']}vkiss.php?sendto={$member['ID']}&from={$recipient['ID']}&ConfCode={$ConfCode}</a>" : "<a href=\"{$site['url']}cc.php\">{$site['url']}cc.php</a>"), $message );
      $message      = str_replace( "<ProfileReference>", ($sender ? "<a href=\"{$site['url']}profile.php?ID={$member['ID']}\">{$sender['NickName']} ({$site['url']}profile.php?ID={$member['ID']}) </a>" : "<b>". _t("_Visitor") ."</b>" ), $message );

      if ('HTML' == $recipient['EmailFlag'])
      {
            $headers = "MIME-Version: 1.0\r\n" . "Content-type: text/html; charset=iso-8859-1\r\n" . $headers;
            $mail_ret = mail( $recipient['Email'], $subject, $message, $headers, $headers2 );
      }
      else
      {
            $mail_ret = mail( $recipient['Email'], $subject, html2txt($message), $headers, $headers2 );
      }
      
      if ( !$mail_ret )
      {
            return 10;
      }

      // Insert kiss into database
      $kiss_arr = db_arr( "SELECT `ID` FROM `VKisses` WHERE `ID` = {$member['ID']} AND `Member` = {$recipient['ID']} LIMIT 1", 0 );
      if ( !$kiss_arr )
            $result = db_res( "INSERT INTO `VKisses` ( `ID`, `Member`, `Number`, `Arrived`, `New` ) VALUES ( {$member['ID']}, {$recipient['ID']}, 1, NOW(), '1' )", 0 );
      else
            $result = db_res( "UPDATE `VKisses` SET `Number` = `Number` + 1, `New` = '1', `Hide` = 0 WHERE `ID` = {$member['ID']} AND `Member` = {$recipient['ID']}", 0 );

      // If success then perform actions
      if ( $result )
            checkAction( $member['ID'], ACTION_ID_SEND_VKISS, true );
      else
            return 1;

      return 0;
}

?>
You use a global array ($site) in this function MemberSendVKiss(). I don't see it being defined anywhere. Is it done in the includes? Also, are you sure all array key used are actually present in the array?

under
global $site;

Kan you add this line and show me the output?
print_r($site);die();
Avatar of ijk111

ASKER

It is defined in
require_once( "inc/header.inc.php" );

The script is fine as when I run the function on localhost on a windowsxp machine with argosoft mailserver I donot have the problem with the same script
ASKER CERTIFIED SOLUTION
Avatar of TeRReF
TeRReF
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ijk111

ASKER

Thank you it works.
Great job
You're welcome :)