contact.php is not working

Discussion in 'Installation/Configuration' started by golan, Jun 21, 2007.

  1. golan

    golan New Member

    Hi,
    I have a contact.php which i tested on the other website which is hosted by other company and it works fine. But when i am using it on the other website which i am hosting it by myself it is not working!
    Is it any configuration on my Apache servre which i need to do to make this page working?

    Your help is appreciated.

    Thanks
    Golan

    The Contact file is:
    ----------------------------------------------------------------------
    <?
    Error_Reporting(E_ALL & ~E_NOTICE);

    while ($request = current($_REQUEST)) {
    if (key($_REQUEST)!='recipient') {
    $pre_array=split ("&777&", $request);
    $post_vars[key($_REQUEST)][0]=$pre_array[0];
    $post_vars[key($_REQUEST)][1]=$pre_array[1];
    }
    next($_REQUEST);
    }



    reset($post_vars);
    $subject="From ".$post_vars['your_name'][0] ;
    $headers= "From: ".$post_vars['your_email'][0] ."\n";
    $headers.='Content-type: text/html; charset=iso-8859-1';
    $message='';
    while ($mess = current($post_vars)) {
    if ((key($post_vars)!="i") && (key($post_vars)!="your_email") && (key($post_vars)!="your_name")) {

    $message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";
    }
    next($post_vars);
    }

    mail("[email protected]", $subject, "
    <html>
    <head>
    <title>Contact letter</title>
    </head>
    <body>
    <br>
    ".$message."
    </body>
    </html>" , $headers);
    echo ("Your message was successfully sent!");

    ?>
    <script>
    resizeTo(300, 300);
    </script>
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Which lines get added to the mail log file when you send a email with your php script?
     
  3. golan

    golan New Member

    Hi Till,
    I dont get what do you mean, would you please explaine it a bit more?

    Thanks
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Have a look at your mail log file which i in the directoyr /var/log/ and post the line that got added to this file when you send a email with the above php script.
     
  5. golan

    golan New Member

    Hi Till,
    Here is the lines:

    Jun 21 14:38:24 localhost postfix/pickup[11260]: EF7B3BB0072: uid=48 from=<apache>
    Jun 21 14:38:25 localhost postfix/cleanup[13184]: EF7B3BB0072: message-id=<[email protected]>
    Jun 21 14:38:25 localhost postfix/qmgr[25099]: EF7B3BB0072: from=<[email protected]>, size=424, nrcpt=1 (queue active)
    Jun 21 14:38:26 localhost postfix/smtp[13186]: EF7B3BB0072: to=<[email protected]>, relay=f.mx.mail.yahoo.com[209.191.88.247]:25, delay=1.3, delays=0.08/0.2/0.75/0.27, dsn=2.0.0, status=sent (250 ok dirdel)
    Jun 21 14:38:26 localhost postfix/qmgr[25099]: EF7B3BB0072: removed
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Ok, this means your script and server is working fine and the email has been sent to the yahoo account. I guess that yahoo has deleted your email as it was sent from the sender address "[email protected]". You should check that you have set a valid hostname for your server.
     
  7. golan

    golan New Member

    Hi Till,
    how can i check it?

    Thanks
     
  8. golan

    golan New Member

    In regard to this issue when i am sending to my email address at xxxx@mydomainname it works prefect.

    Thanks
     
  9. falko

    falko Super Moderator Howtoforge Staff

    What's the output of
    Code:
    hostname
    and
    Code:
    hostname -f
    and
    Code:
    postconf -n
    ?
     
  10. golan

    golan New Member

    Output of hostname and hostname -f is: localhost.localdomain
    and output of postconf -n is:
    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases
    broken_sasl_auth_clients = yes
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    daemon_directory = /usr/libexec/postfix
    debug_peer_level = 2
    home_mailbox = Maildir/
    html_directory = no
    inet_interfaces = all
    mail_owner = postfix
    mailbox_command =
    mailq_path = /usr/bin/mailq.postfix
    manpage_directory = /usr/share/man
    mydestination = /etc/postfix/local-host-names
    mynetworks = 127.0.0.0/8
    newaliases_path = /usr/bin/newaliases.postfix
    queue_directory = /var/spool/postfix
    readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
    sample_directory = /usr/share/doc/postfix-2.3.3/samples
    sendmail_path = /usr/sbin/sendmail.postfix
    setgid_group = postdrop
    smtp_tls_note_starttls_offer = yes
    smtp_use_tls = yes
    smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_local_domain =
    smtpd_sasl_security_options = noanonymous
    smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
    smtpd_tls_auth_only = no
    smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
    smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_timeout = 3600s
    smtpd_use_tls = yes
    tls_random_source = dev:/dev/urandom
    unknown_local_recipient_reject_code = 550
     
  11. falko

    falko Super Moderator Howtoforge Staff

    You need to set a proper hostname in your Postfix configuration:
    Code:
    postconf -e 'myorigin = my.hostname.tld'
    /etc/init.d/postfix restart
    If you are not sure what hostname to use, you can look up a hostname using the server's public IP address:
    Code:
    dig -x 1.2.3.4
    where 1.2.3.4 must be replaced with the server's real public IP address.
     
  12. golan

    golan New Member

    Dear Falko,
    Below is the result of the dig command.
    But i have a question. if i buy a domain name as mydomain.com and ask the registrar for name servers as ns1.mydomain.com and ns2.mydomain.com then how can i set my server with these addresses?

    Thanks


    ; <<>> DiG 9.3.3rc2 <<>> -x 209.52.151.168
    ;; global options: printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6698
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

    ;; QUESTION SECTION:
    ;168.151.52.209.in-addr.arpa. IN PTR

    ;; ANSWER SECTION:
    168.151.52.209.in-addr.arpa. 60 IN PTR s209-52-151-168.bc.hsia.telus.net.

    ;; AUTHORITY SECTION:
    151.52.209.in-addr.arpa. 44141 IN NS helium.bc.tac.net.
    151.52.209.in-addr.arpa. 44141 IN NS neon.bc.tac.net.

    ;; ADDITIONAL SECTION:
    neon.bc.tac.net. 21524 IN A 209.53.4.150
    helium.bc.tac.net. 21525 IN A 209.53.4.130

    ;; Query time: 17 msec
    ;; SERVER: 192.168.0.1#53(192.168.0.1)
    ;; WHEN: Tue Jun 26 15:05:56 2007
    ;; MSG SIZE rcvd: 171
     
  13. till

    till Super Moderator Staff Member ISPConfig Developer

  14. golan

    golan New Member

    Hi Till,
    I believe i need to explain my question a little more:
    I have a sever which i would like to use it as a web server and host websites.
    whenever i register a domain they asked me about the name servers which i dont have and instead i give them my web server ip.
    And it works but has problem as i described at my first post.
    So to resolve this issue which i explained at my first post do i need to have a name server?
    And i have a domain like www.mydomin.com which point to my web server ip address and if ask my registrar for the name servers such as ns1.mydomain.com and ns2.mydomain.com which points to my web server ip address:
    Now if i want to rigister a new domain and hosted on my server can i give this two name servers instead the web server ip address (which are same) to the registrar?

    Thanks
    Golan
     
    Last edited: Jul 4, 2007
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    I guess what you need is a technical domain. That means a domain that points to your server IP with 2 A-Records, e.g. ns1 yourserver.com and ns2.yourserver.com, but the dns for this domain is not hosted on your server.

    You can either achieve this by using managed DNS for one of your domains from your domain registrar or you use a domain from e.g. dyndns or noip to point to your server.
     

Share This Page