www.webdeveloper.com
Results 1 to 4 of 4

Thread: mail() function

  1. #1
    Join Date
    Feb 2005
    Location
    Nova Scotia
    Posts
    101

    mail() function

    I have php & apache setup on my mac at work (apache is shipped with os x 10.3.3)

    I have a script that uses the mail function and it runs on my machien (http://localhost/etc...) I run the script and it says the mail sent successfully ( based on if ( ! $mail ) test )
    However I do not recieve the email I have sent to myself.

    The code is fine, I've checked it several times, here it is for discussion sake:


    <html>
    <head>
    <title>email test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body bgcolor="#FFFFFF" text="#000000">
    <?php
    $addr = "testaddress";
    $subject = "test";
    $string = "testing mail function";
    $mail = mail($addr, $subject, $string);

    if (!$mail)
    { echo "mail function failed to process"; }
    else
    { echo "mail function processed successfully"; }

    ?>
    </body>
    </html>

    And yes "testaddress" lists the address and not the preceding string in the script.

    If all that looks legit, then what is the problem here? could it be a setting in apache?

  2. #2
    Join Date
    Jan 2003
    Location
    Texas
    Posts
    10,413
    Check your PHP.ini file and make sure that "SMTP" is set to your outgoing SMTP mail server. Also make sure that your ISP does not block port 25 (usually this isn't the case, though).
    Visit Slightly Remarkable to see my portfolio, resumé, and consulting rates.

  3. #3
    Join Date
    Feb 2005
    Location
    Midwest, USA
    Posts
    42
    T-Wag:

    Just some feedback...

    I pasted your code into a PHP file on my website...

    Changed the address ran it and it worked the first time. If you want to, send me an email address to hardcode and you can try it from my site.

    You probably want to pursue Jona's line of thought, though.


    Thought you might be interested,
    Mitch

  4. #4
    Join Date
    Feb 2005
    Location
    Nova Scotia
    Posts
    101
    Thanks Jona & mitcon, I'll definitly look into the php.ini issue and..hmm, the isp may be an issue but it should be resolve able by monday when our server consultant comes in and I can have him tweak what needs be tweaked should tweaking be in order.

    mitcon, I'd appreciate it if you could try my email address, thanks. I'll PM it to you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles