Results 1 to 5 of 5

Thread: page success but no email sent

  1. #1
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default page success but no email sent

    Hai... I'm new in this forum.. I need help in php email. I've got sick searching around the net about this but yet I can't find any solution. So if there anybody out there would help me, I will really appreciate.

    1st example

    [mail function]
    ; For Win32 only.
    SMTP = localhost
    smtp_port=25

    ; For Win32 only.
    sendmail_from = me@localhost.com

    php file :
    <?php
    $to = 'serene@gmail.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: webmaster@localhost.com' . "\r\n" .
    'Reply-To: webmaster@localhost.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

    mail($to, $subject, $message,$header);
    ?>

    when I use this one, no error appear, but the email itself does not sent.

    2nd example

    [mail function]
    ; For Win32 only.
    SMTP = mail.example.com
    smtp_port=25

    ; For Win32 only.
    sendmail_from = me@example.com

    php file
    <?php
    $to = 'serene@gmail.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();


    mail($to, $subject, $message,$header);
    ?>

    an error appear
    Warning: Server Error in c:\apache\htdocs\e-score\test_email.php on line 13

    and line 13 : mail($to, $subject, $message,$header);

    anybody have any idea on how to fix this one????

  2. #2
    Join Date
    May 2007
    Location
    Sweden
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post

    Quote Originally Posted by suedree View Post
    Hai... I'm new in this forum.. I need help in php email. I've got sick searching around the net about this but yet I can't find any solution. So if there anybody out there would help me, I will really appreciate.

    ....

    when I use this one, no error appear, but the email itself does not sent.

    ....

    an error appear
    Warning: Server Error in c:\apache\htdocs\e-score\test_email.php on line 13

    and line 13 : mail($to, $subject, $message,$header);

    anybody have any idea on how to fix this one????
    Hi, Suedree!

    You have named "$headers" as "$header" in both cases when you send the mail:

    Change to this instead, then you can try again;
    PHP Code:
    <?php

        $to 
    "serene@gmail.com";
        
    $subject 'the subject';
        
    $message 'hello';

        
    $headers[] = "From: webmaster@localhost.com";
        
    $headers[] = "Reply-To: webmaster@localhost.com";
        
    $headers[] = "X-Mailer: PHP/" phpversion();

    mail($to$subject$messageimplode("\r\n"$headers) );
    ?>
    Is this the right soloution?

    Best regards,
    mbrodin
    Last edited by mbrodin; 06-01-2007 at 10:21 AM.

  3. #3
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank mbrodin,
    I already figured the error but it seems like I cannot send email from localhost. Is it because I'm doing it in my laptop?? and when I try to setup the php.ini

    [mail function]
    ; For Win32 only.
    SMTP = mail.global.com
    smtp_port=25

    ; For Win32 only.
    sendmail_from =admin@global.com

    <?php

    $to = "advin@global.com";
    $subject = 'the subject';
    $message = 'hello';

    $headers= "From: admin@global.com";

    mail($to, $subject, $message,$header);
    ?>

    it works but I cannot send email other than global.com such as yahoo or gmail. I still didn't figure it out....

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Yahoo and Gmail mail servers require that you log in to their servers before sending mail through them. Probably, global.com is a mail realyer (subject to spamming and DNS blacklisting) and this is why you are able to send through them. If you were to use your laptop to send emails (if you were running a XAMPP, WAMP, LAMP server), you would need a mail server (or sendmail executable) as well. If you are on a Windows system, I recommend using hMailServer.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  5. #5
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi thetestingsite,
    Thank for the advice... but what you mean by log in to yahoo or gmail servers before sending mail through them?? Is it because they block outside email form coming in??? Let say the global.com is my company's mail server, and I have to set the php.ini like this if not the email cannot be send or an error occurred:

    [mail function]
    ; For Win32 only.
    SMTP = mail.global.com
    smtp_port=25

    ; For Win32 only.
    sendmail_from = admin@global.com


    for gmail and yahoo, do I need to setup the php.ini like this??


    [mail function]
    ; For Win32 only.
    SMTP = mail.yahoo.com
    smtp_port=25

    ; For Win32 only.
    sendmail_from = admin@yahoo.com


    As you say, I'm using windows system so I take ur advice to use hMailserver and I already install it in my laptop, but it seem like this software just to register or add new email to the specific domain but I can't understand how this software work with my php configuration. Can u advice me on how to make it work with my php???
    Last edited by suedree; 06-06-2007 at 03:22 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •