PHP Scripting Forums » General Web Development Forum

mail function usage

(10 posts)
Great offers not only for geeks!
Your Ad Here

  1. User has not uploaded an avatar

    jyobeer
    Member

    hi
    i am new to php
    i was learning it from the php crookbook
    i am stuck at php mail function
    am not getting the mail in my destination mail id
    can u just help me by guiding step by step procedure how to get it rite

    Posted 3 months ago #
  2. and what is your code you have problems with?

    do you tried the example from the PHP website?

    <?php
    // The message
    $message = "Line 1\nLine 2\nLine 3";
    
    // In case any of our lines are larger than 70 characters, we should use wordwrap()
    $message = wordwrap($message, 70);
    
    // Send
    mail('caffinated@example.com', 'My Subject', $message);
    ?>
    Posted 3 months ago #
  3. User has not uploaded an avatar

    jyobeer
    Member

    am trying with this code
    but am unable to get the mail in my yahoomail id as provided by me in this function

    <?php

    $to = "jsbehera@yahoo.co.in";
    $subject = "My subject";
    $txt = "Hello world!";
    $headers = "From: webmaster@example.com"."\r\n"."CC: somebodyelse@example.com";

    if (mail($to,$subject,$txt,$headers)) {
    echo("<p>Message sent!</p>");
    } else {
    echo("<p>Message delivery failed...</p>");
    }

    ?>

    Posted 3 months ago #
  4. so do you get the mail message in a different account (gmail for example)?

    if the basic php code doesn't work maybe the mail function is disabled by your hosting provider...

    Posted 3 months ago #
  5. User has not uploaded an avatar

    jyobeer
    Member

    nope i have tried for it but not getting mails in gmail account also
    so please tell me how to enable the mail function in my local host

    Posted 3 months ago #
  6. Quote from: jyobeer"nope i have tried for it but not getting mails in gmail account also
    so please tell me how to enable the mail function in my local host"

    maybe you should tell first that you are playing on your local server

    it's windows right?
    check your php.ini file for the smtp settings and use the smtp server from your ISP.

    if he doesn't allow relay, you are far away from using mail on your windows machine (at least as a newbie)

    Posted 3 months ago #
  7. User has not uploaded an avatar

    jyobeer
    Member

    yup am trying with the local server it self
    n yes it is window
    i have checked the smtp setting
    n changed it to

    ; For Win32 only.
    SMTP = some.email.server.com
    smtp_port = 25

    this time i have tried with the simple one
    its showing that message sent but still i didn't get the message <?php

    $to = "jsbehera@yahoo.co.in";
    $subject = "My subject";
    $txt = "Hello world!";
    $headers = "From: webmaster@example.com"."\r\n"."CC: somebodyelse@example.com";

    if (mail($to,$subject,$txt,$headers)) {
    echo("<p>Message sent!</p>");
    } else {
    echo("<p>Message delivery failed...</p>");
    }

    ?>

    now tell me what i need to do further

    Posted 3 months ago #
  8. User has not uploaded an avatar

    jyobeer
    Member

    hey can u tell me from where can i get my ISP server name??

    Posted 3 months ago #
  9. this is what I said if your ISP doesn't allow relay your problem starts, add also your email address you got from your ISP and check their website if they use the SMTP port 25.

    Don't forget this problem is not related to PHP, it's a problem for your server.

    I stopped using the mail function on a local windows server, because it's too much work to get a free SMTP connector working. So if you can't use the SMTP from your ISP use the mail function on a remote machine.

    Posted 3 months ago #
  10. Quote from: jyobeer
    "hey can u tell me from where can i get my ISP server name??"

    don't know, the mail setting for your mail account maybe?

    Posted 3 months ago #

RSS feed for this topic

Reply

You must log in to post.