problem while sending mail

Discussion in 'PHP' started by senthilphp, Sep 18, 2009.

  1. #1
    I'm novice to php. In my application there is a contact form for customer can contact with us. Functionality is mail should be fired with customer detail when the customer submit the form.

    Code
    -----
    contact.php

    if (isset($_POST['contactsub'])) {
    include("smail/newmail.php");
    $name = $_REQUEST['fullName'];
    $email = $_REQUEST['emailadd'];
    $telephone = $_REQUEST['telep'];
    $country = $_REQUEST['smsco'];
    $delivery = $_REQUEST['smsdel'];
    $month = $_REQUEST['smsmon'];
    $query = $_REQUEST['smsque'];

    $message = "<B>Name:</B>&nbsp;$name<br/><B>Email</B>:&nbsp;$email<br/><B>Telephone</B>:&nbsp;$telephone<br/><B>SMS Country of origin</B>:&nbsp$country<br/><B>SMS Country of delivery</B>:&nbsp;$delivery<br/><B>SMS per month</B>:&nbsp;$month<br/><B>Query</B>:&nbsp;$query";

    $mail_sent = sendmail($message);

    }

    newmail.php
    ------------

    function sendmail($message) {

    $name= "ME";
    require_once('class.phpmailer.php');
    $mail = new PHPMailer();

    $from = 'noreply@gamil.com';
    $headers = "From:$from";
    $to = 'test@gamil.com';
    $subject = 'Enquiry';

    $mail->IsSMTP();
    $mail->SMTPAuth = true;
    $mail->SMTPSecure = "ssl";
    $mail->Host = "smtp.gmail.com";
    $mail->Port = 465;

    $mail->Username = 'flashcards@gmail.com';
    $mail->Password = '12345';

    $mail->From = $from;
    $mail->FromName = 'Customer';

    $mail->Subject = $subject;
    $mail->AltBody = "";
    $mail->WordWrap = 50;

    $body_contents = $message;
    $mail->IsHTML(true);
    $header = $headers;

    $mail->AddAddress($to);
    $mail->MsgHTML($body_contents);
    $mail->Send();
    }

    It is working fine in my local system. but after hosting to the server, it is not working.
    Problem is white page is coming, after click the submit.

    Please help me.
     
    senthilphp, Sep 18, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You'll need to show us the error logs.. Check your PHP error log, ask your host if you don't know how to find it.
     
    premiumscripts, Sep 18, 2009 IP