+ Post New Thread
Results 1 to 11 of 11
Web Development Thread, PHP Mail in Coding and Web Development; Just done a php script. User types in the details and when presses send - sends an email to me. ...
  1. #1

    Join Date
    Apr 2007
    Location
    Ramsbottom, Bury, Lancs
    Posts
    581
    Thank Post
    11
    Thanked 5 Times in 5 Posts
    Rep Power
    20

    PHP Mail

    Just done a php script. User types in the details and when presses send - sends an email to me. It gets to the end of the script but the email never arrives?

    Code below:

    <?php
    $name = $_REQUEST['name'] ;
    $room = $_REQUEST['room'] ;
    $message = $_REQUEST['message'] ;

    mail( "ictsupport@bostonspa.org.uk", "Message from Intranet",
    $message, "From: $name" );
    header( "Location: http://2003server:84" );
    ?>

    Thanks

  2. #2

    CESIL's Avatar
    Join Date
    Nov 2006
    Location
    Hampshire
    Posts
    1,405
    Thank Post
    109
    Thanked 267 Times in 198 Posts
    Rep Power
    169
    What platform are you running this on?

    The mail() function will send email via the server specified in php.ini

    On a *nix box this usually set to go via sendmail

    On a windows server you need to configure SMTP (I think).

    I host my sites on Linux but develop on a WAMP setup so I can only test email on the live server, until I can figure out how to get email to work on windows

  3. #3

    Join Date
    Apr 2007
    Location
    Ramsbottom, Bury, Lancs
    Posts
    581
    Thank Post
    11
    Thanked 5 Times in 5 Posts
    Rep Power
    20
    Running on Vanilla Win 2003 server with WAMP installed. Thanks for pointing in line of php.ini

    Changed to this but still the same:

    [mail function]
    ; For Win32 only.
    SMTP = smtp.redstone4schools.co.uk
    smtp_port = 25

    ; For Win32 only.
    sendmail_from = xxx@xxx.org.uk
    Last edited by karldenton; 15th May 2009 at 09:47 AM.

  4. #4

    matt40k's Avatar
    Join Date
    Jun 2008
    Location
    Ipswich
    Posts
    4,522
    Thank Post
    374
    Thanked 677 Times in 551 Posts
    Rep Power
    166
    Your mail servers would reject it as it's not authenticated. At a guess.

  5. #5

    Join Date
    Apr 2007
    Location
    Ramsbottom, Bury, Lancs
    Posts
    581
    Thank Post
    11
    Thanked 5 Times in 5 Posts
    Rep Power
    20
    Possibly, but I use the above settings on printers to email me and they work fine. The mail servers are external

  6. #6
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    119
    I'd obfuscate your email in that example if I were you... spiders and spammers will grab it in a flash.

  7. #7

    Join Date
    Apr 2007
    Location
    Ramsbottom, Bury, Lancs
    Posts
    581
    Thank Post
    11
    Thanked 5 Times in 5 Posts
    Rep Power
    20
    OK, got it working by installing smtp on the server - can't be doing with the isp one !

    On the php code

    <?php
    $name = $_REQUEST['name'] ;
    $room = $_REQUEST['room'] ;
    $message = $_REQUEST['message'] ;

    mail( "i***@bos*****.org.uk", "Message from Intranet",
    $message, "From: $name");
    header( "Location: http://***:**" );
    ?>

    At the momen I get the email. The subject is "Messge from intranet" and the From is the name someone puts in in the form. How do I get the room and message showing in the message part of the email?

    Thanks

  8. #8

    Join Date
    Apr 2007
    Location
    Ramsbottom, Bury, Lancs
    Posts
    581
    Thank Post
    11
    Thanked 5 Times in 5 Posts
    Rep Power
    20
    Got much further. Got the message coming in now.
    How do it structure the message into English in the body section

    mail( "***", "Message from Intranet", "This is a message from" $name "in room" $room $message, "From: $name");
    header( "Location: http://***:84" );

  9. #9

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,867
    Thank Post
    412
    Thanked 778 Times in 651 Posts
    Rep Power
    182
    Something like:

    PHP Code:
    $body = <<<_MSG_
    This is a message from {$name} in room {$room}.

    Message:

    {$message}
    _MSG_;

    mail"***""Message from Intranet"$body"From: $name <noreply@mydomain.net>"); 

  10. #10
    mossj's Avatar
    Join Date
    Dec 2008
    Location
    Leicester
    Posts
    1,466
    Thank Post
    157
    Thanked 189 Times in 174 Posts
    Rep Power
    53

  11. #11

    Join Date
    Apr 2007
    Location
    Ramsbottom, Bury, Lancs
    Posts
    581
    Thank Post
    11
    Thanked 5 Times in 5 Posts
    Rep Power
    20
    Thanks. Managed to sort it. did the concatinate thing



SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 1
    Last Post: 20th May 2008, 12:09 PM
  2. Web mail in os 10.5 (aka squirrel mail)
    By mactech03 in forum Mac
    Replies: 0
    Last Post: 2nd May 2008, 06:22 PM
  3. Replies: 7
    Last Post: 4th March 2008, 11:54 AM
  4. PHP script to downlod mail
    By russdev in forum Web Development
    Replies: 2
    Last Post: 20th January 2008, 04:22 PM
  5. PHP IMAP check mail script
    By netadmin in forum Web Development
    Replies: 2
    Last Post: 22nd April 2007, 04:47 AM

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
  •