Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 10 of 10

Thread: mail()

  1. #1

    Default mail()

    Hi,

    I get this error when using the mail() function;
    Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in \\nas-001\winspace002\10-didehvar.com\www\lq.php on line 168
    Code;

    PHP Code:
    <?php
     
      
    if (!$_POST['submit'])
      {
          
            echo(
    "<form action='' method='post'>
            Your Name: <br />
            <input type='text' name='name' size='20' />
            <br /><br />
            Your Query: <br />
            <textarea name='query' cols='20' rows='5'></textarea>
            <br /><br />
            <input type='submit' value='Submit Form' /></form>"
    );
            
            
    $headers .= 'To: Me <>' "\r\n"
            
    $headers .= 'From: Contact Form From ' "\r\n";
            
            
    $name $_POST['name'];
            
    $query $_POST['query'];
            
            
    $to "";
            
    $subject "Contact Form - $name";
            
            
    mail($to$subject$query$headers);
      }
      else
      {
          die(
    "Script failed.");
      }
      
      
    ?>
    Regards,
    James.
    Last edited by Chris; 19-03-2014 at 05:53 PM.

  2. #2
    Join Date
    Sep 2008
    Location
    UK
    Posts
    3,670
    Tokens
    0

    Latest Awards:

    Default

    Try:

    PHP Code:
     <?php 
      
      
    if (!$_POST['submit']) 
      { 
           
            echo(
    "<form action='' method='post'> 
            Your Name: <br /> 
            <input type='text' name='name' size='20' /> 
            <br /><br /> 
            Your Query: <br /> 
            <textarea name='query' cols='20' rows='5'></textarea> 
            <br /><br /> 
            <input type='submit' value='Submit Form' /></form>"
    ); 
             
            
    $headers .= 'To: Me <>' "\r\n";  
            
    $headers .= 'From: Contact Form From Didehvar.com' "\r\n"
             
            
    $name $_POST['name']; 
            
    $query $_POST['query']; 
             
            
    $to ""
            
    $subject "Contact Form - $name"
             
            
    mail("$to"$subject$query$headers); 
      } 
      else 
      { 
          die(
    "Script failed."); 
      } 
       
      
    ?>
    Last edited by Chris; 19-03-2014 at 05:53 PM.
    Back for a while.

  3. #3

    Default

    Quote Originally Posted by Excellent2 View Post
    Try:

    PHP Code:
     find above
    Nope, still get the same error. +Rep for trying,
    Edit: Must spread.

  4. #4
    Join Date
    Sep 2008
    Location
    UK
    Posts
    3,670
    Tokens
    0

    Latest Awards:

    Default

    Forgot to read the error, oops. It's a problem with your localhost so it says, not sure about that then
    Back for a while.

  5. #5

    Default

    Quote Originally Posted by Excellent2 View Post
    Forgot to read the error, oops. It's a problem with your localhost so it says, not sure about that then
    Yeah, but its actually on a website. I've been looking around and its something to do with php.ini (obviously?).

    Er, what exactly would I fill this in with;
    Source(http://uk3.php.net/mail)
    PHP Code:
    ini_set('sendmail_from''[email protected]'); 

  6. #6
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Contact your host as they'll need to make adjustments in the PHP configuration in order for the mail function to work. Unless you want to set the SMTP server manually yourself...

  7. #7
    Join Date
    Jul 2008
    Location
    Hastings, UK.
    Posts
    2,050
    Tokens
    0

    Latest Awards:

    Default

    Verify that the server you're using has mail extensions, most likely if you're using XAMPP then it's un-likely that you'll have mail extensions too

    I can't help noticing that your website appears to be a cPanel account on my server, but i I whois it it's hosted somewhere else.
    Last edited by Calon; 02-12-2008 at 06:32 PM.

  8. #8

    Default

    No cPanel, just an account + hosting manager.

    I suppose I'll have to get in contact then if I have no other options.

  9. #9
    Join Date
    Nov 2007
    Location
    London
    Posts
    1,577
    Tokens
    36

    Latest Awards:

    Default

    Either PHP isn't configured correctly to work with mail/is purposely not configured correctly to work with mail or your host's SMTP is down.

    Eitherway, you should contact them, it's nothing to do with your code.
    Kind Regards,

    Guy
    __________________

    Since 2007. Unbelievable Uptime. Web hosting, resellers, master resellers, linux VPS, windows VPS, shoutcasts, at the lowest prices on the net.
    Tech-Hosts.co.uk.


  10. #10

    Default

    Quote Originally Posted by iUnknown View Post
    Either PHP isn't configured correctly to work with mail/is purposely not configured correctly to work with mail or your host's SMTP is down.

    Eitherway, you should contact them, it's nothing to do with your code.
    I just worked round it, using the fwrite function, who needs email spam?

Posting Permissions

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