Jump to content

PHP.ini Odl Timer Needs Ur Help


Tam_Zeb

Recommended Posts

Hey Guy's

 

I need a quick fix to solve an urgent problem..

 

I used to do some coding years ago but the old grey matter is not so responsive these days and I have been up all night trying to resolve a problem.

 

I have built a website for my daughters and created a simple web form but I have come unstuck. All those skills I once took for granted are gone.

 

So here's where I am at. I've created an input form_mail.html, a contact.php and a reply.html page uploaded them to the Server and hit an error when I tried to send a message. The problem it seems is with the PHP.ini File.

 

In short I don't have one Duh! Yes I know I should go back and study and that much I intend to do I am currently installing xxampp, MySQL and php on my new laptop.

 

But in the meantime I need your help urgently..

 

What code do I need in the php.ini file to make the Form Mail work?

 

Is there somewhere on the web where I can see a simple code, I am just too tired to wade through heavy docs right now.

 

Your help would be much appreciated at this time.

 

Sincerely

 

Tam

 

 

 

 

Link to comment
Share on other sites

Hi Guy's

 

Thanks for your prompt responses..

 

How do I know it's the php.ini - I don't have a php.ini on my server side I did a quick test to see what message I got and the message I got back made reference to the php.ini. When I checked the Server no php.ini

 

This is the sample code I am using for the contact.php I have removed the email address at the top of the page

 

 

Opps for some reason the site won't let me paste anything

Link to comment
Share on other sites

Opps for some reason the site won't let me paste anything

There shouldnt be any issued pasting code.

 

Although please do wrap your code in

tags, either type those tags manually or click the <> (code) button in the editor to paste your code. If you continue to have issues, then either attach your php files to your post or post a link to your code at pastebin,com

Edited by Ch0cu3r
Link to comment
Share on other sites


<?php
/* Set e-mail recipient */
$myemail = "MY GOES EMAIL HERE";

/* Check all form inputs using check_input function */
$yourname = check_input($_POST['yourname'], "Enter your name");
$subject = check_input($_POST['subject'], "Write a subject");
$email = check_input($_POST['email']);
$comments = check_input($_POST['comments'], "Write your comments");

/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
show_error("E-mail address not valid");

}

/* Let's prepare the message for the e-mail */
$message = "Hello!

Your contact form has been submitted by:

Name: $yourname
E-mail: $email

Comments:
$comments

End of message
";

/* Send the message using mail() function */
mail($myemail, $subject, $message);

/* Redirect visitor to the thank you page */
header('Location: thanks.html');
exit();

/* Functions we used */
function check_input($data, $problem='')
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
if ($problem && strlen($data) == 0)
{
show_error($problem);
}
return $data;
}

function show_error($myError)
{
?>
<html>
<body>

<b>Please correct the following error:</b><br />
<?php echo $myError; ?>

</body>
</html>
<?php
exit();
}
?>
Link to comment
Share on other sites

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in E:\kunden\homepages\24\d540637311\www\mailtest.php on line 2
 Mail sent!

Sorry if that came over rather rudely I am still feeling pretty rough.

 

Ok I ran the mailtest.php and here is the error

 

 

 

Link to comment
Share on other sites

create a file called php.ini with the content:

[PHP]
sendmail_from = your@email.com
Then upload it to the root folder of your hosting account. For some hosts this is enough to create your own php.ini files. If that does not work you can either contact your host to find out how they handle it, or follow the second part of the error's suggestion (or custom "From:" header missing) and add your custom From: header using the fourth parameter to mail
Link to comment
Share on other sites

Hi Guru

 

Sorry but this is all double dutch to me now. There was I time when I knew all this stuff back in 2002 but I haven't done any coding since about 2008. How quickly ones memory fades. I had thought my Host Provider would have some guidance notes a but alas  it's not as user friendly as the old websites used to be where the Host Providers were enthusiastic pioneers  keen to help Webmaster build and maintain websites on dialup systems. Now it's just a business and making money..

Link to comment
Share on other sites

$myemail = "MY GOES EMAIL HERE"; //change to your email address
mail($myemail, $subject, $message, 'From: ' . $myemail);

it's

mail(to, subject, message, headers)

where "headers" can also be additional headers like "reply-to" but needs to contain at least the From header.

 

Additionally, mail() returns a boolean to tell whether it was successful or not. So you can do something like:

if (mail(to, subject, message, from))
{
  echo 'email sent';
} else {
  echo 'there was a problem sending the email';
}
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.