Page 1 of 1

Mailto

Posted: Wed Dec 30, 2009 12:37 pm
by hero789
I have set up a server on my localhost. I am trying to send email to the server administration at admin.ituk.com. This is the internet url I have set up.
I am using the code below. Whenever I try to send an email I get the following error:- could not perform operation as default mail client is not installed. Does anyone know what this means.

Code: Select all

 
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://localhost/project/website/css/homepage.css"/>
<title>IT Consul UK</title>
</head>
<body>
<form action="mailto:admin.ituk.com" method="post" enctype="text/plain">
<p>Name: <input type="text" name="name" value="" size="50"/>
<p>Email: <input type="text" name = "email" value="" size="50"/></p>
<p>Subject: <input type="text" name="subject" value="" size = "50"/></p>
<p>Message:<br />
<textarea name="message" rows="10" cols="50" name ="message" value=""></textarea></p>
<input type="submit" name="submit" value="submit"/>
<input type="reset" name = "reset" value="reset"/>
</body>
</form>
</html> 
 

Re: Mailto

Posted: Wed Dec 30, 2009 12:55 pm
by hero789
Hi I have changed my form. I now use mail(). However now rather than get an error message I get a blank screen with the absolute directory to my email form being displayed in the url.

Code: Select all

<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://localhost/project/website/css/homepage.css"/>
<title>IT Consul UK</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<p>Name: <input type="text" name="name" value="" size="50"/>
<p>Email: <input type="text" name = "email" value="" size="50"/></p>
<p>Subject: <input type="text" name="subject" value="" size = "50"/></p>
<p>Message:<br />
<textarea name="message" rows="10" cols="50" name ="message" value=""></textarea></p>
<input type="submit" name="submit" value="submit"/>
<input type="reset" name = "reset" value="reset"/>
</body>
</form>
</html>
<?php
if(isset($_POST['submit']))
    {
    $name = $_POST['name'];
    //$email = $POST['email'];
    $email = "admin.ituk.com";
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    //now mail it
    mailto($email, $subject, $message, $name);
    }
    else
    {
    echo "<p>Mail failure</p>";
    }
?> 
 

Re: Mailto

Posted: Wed Dec 30, 2009 1:07 pm
by hero789
HI

I have now adjusted my code again.

Code: Select all

<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://localhost/project/website/css/homepage.css"/>
<title>IT Consul UK</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<p>Name: <input type="text" name="name" value="" size="50"/>
<p>Email: <input type="text" name = "email" value="" size="50"/></p>
<p>Subject: <input type="text" name="subject" value="" size = "50"/></p>
<p>Message:<br />
<textarea name="message" rows="10" cols="50" name ="message" value=""></textarea></p>
<input type="submit" name="submit" value="submit"/>
<input type="reset" name = "reset" value="reset"/>
</body>
</form>
</html>
<?php
if(isset($_POST['submit']))
    {
    //$from = $_POST['name'];
    
    //$email = $POST['email'];
    $from = "postmaster@localhost";
    $email = "admin@ituk.com";
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    //now mail it
    mail($email, $subject, $message, $from);
    }
    else
    {
    echo "<p>Mail failure</p>";
    }
?> 
 
I now get the message
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in I:\xampp\htdocs\Project\Website\pagecontent\site_text_content\mail.php on line 32

Re: Mailto

Posted: Wed Dec 30, 2009 1:12 pm
by hero789
I have altered my php.ini file uncommenting send_mail and now I get the following error:-
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 I:\xampp\htdocs\Project\Website\pagecontent\site_text_content\mail.php on line 32

Re: Mailto

Posted: Wed Dec 30, 2009 2:16 pm
by hero789
I am still getting this error:-
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 I:\xampp\htdocs\Project\Website\pagecontent\site_text_content\mail.php on line 34

Re: Mailto

Posted: Wed Dec 30, 2009 2:22 pm
by hero789
I just realised what I was doing wrong. In http-vhosts.conf I have the virtual host uncommented
#<VirtualHost *:80>
#ServerAdmin postmaster@localhost
#DocumentRoot "/xampp/htdocs/"
#ServerName http://www.ituk.com
#</VirtualHost>
whilst php.ini was still reading smtp = localhost or something like that. Although by turning on virtualhosts the original httpd.conf information is overriden so basically localhost no longer existed. I have now commented the virtualhost above and now I get another error message.

Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

Re: Mailto

Posted: Wed Dec 30, 2009 3:14 pm
by daedalus__
are you a domain squatter?