473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

php mail function error

134 100+
Hello,

I am trying to create a mail function for my contact form and for my registration system.
But I repeatedly getting the same error:

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\website\actie.php on line 21

I've already searched for solutions on google, but I couldn't find one which solved my problem.

the things I've tried to change:
smtp in php.ini and the sendmail_from (none of the php.ini files found in xampp/php/php.ini changed a value in the phpinfo)
mercury mail server from xampp activated.

the code for my contact form is split up in 2 php files with the following code

contact.php
Expand|Select|Wrap|Line Numbers
  1. <form method="POST" action="actie.php"><br>
  2.                     Name:<br><input type="text" name="naam" size="50"><br>
  3.                     E-mail:<br><input type="text" name="email" size="50"></select><br>
  4.                     Subject:<br><input type="text" name="subject" size="50"></select><br>
  5.                     Tekst:<br><textarea rows="3" name="tekst" cols="75"></textarea>
  6.                     <br><input type="submit" name="verzend" value="Verzenden">
  7.  
action.php
Expand|Select|Wrap|Line Numbers
  1. $ontvanger = "my email@address.com";
  2. $onderwerp = "Iemand heeft je formulier ingevuld";
  3.  
  4. // We definiëren vervolgens de veranderlijke variabelen.
  5. $naam = $_POST['naam'];
  6. $email = $_POST['email'];
  7. $subject = $_POST['subject'];
  8. $tekst = $_POST['tekst'];
  9. $headers= 'To: <michael.bruin@live.nl>' . "\r\n";
  10. // Bericht
  11.  
  12. $bericht = "Iemand heeft je contactformulier ingevuld.\nHet gaat om '".$naam."', met het e-mailadres '".$email."', wonende in '".$subject."'. Hij vulde de volgende opmerking in:\n'".$tekst."'";
  13. $tekst = str_replace("\n.", "\n..", $tekst);
  14.  
  15. // Verzenden
  16. mail($ontvanger, $onderwerp, $bericht, $headers);
  17.  
  18. // Bericht verzonden
  19.  
  20. echo "Uw bericht werd verzonden.";
  21.  
and the part of my registration file which won't send the mail:
Expand|Select|Wrap|Line Numbers
  1. $mail = mail($_POST['email'],"Registratie ".$sitenaam,$bericht,"From: ".$sitenaam." <".$sitemail.">");
  2.  
thanks for reading and many thanks if you can help me with this problem.
Jun 16 '11 #1
5 3145
Dormilich
8,658 Expert Mod 8TB
as said in the error message (and of course in the Manual), you need a From: header field. (that concerns the first code, line #16)
Jun 17 '11 #2
I too facing the same prob... Help me...
Jun 22 '11 #3
michaeldebruin
134 100+
The problem is solved for me. I had the problem that the mail function wasn't enabled in my php.ini. And I couldn't find the right php.ini thanks to the fact that I somehow had 3 php.ini and none of them could make any difference to my phpinfo. But now that my website is online and I have an email account on it, I am enable to send emails with the php code which is displayed above. I also used the tip of Dormilich to dubble check my "From:" header and changed it a bit.
Jun 22 '11 #4
Will u plz explain me how to enable mail function in php.ini?
Jun 22 '11 #5
michaeldebruin
134 100+
you will have to search in php.ini for mail function and then at smtp the smtp of your provider. To give an example the email acount from my website is his own provider which makes it mail.it-traffic.com. Afther that you will have to set the port, this is mostly port 25. Then check if your phpinfo at mail function is correct. If it is correct you should be able to send a mail with your php script. Ofcourse you will have to all the headers and stuff like that to your wishes: http://nl.php.net/manual/en/function.mail.php
This site can help you with that the php mail function
Jun 22 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: vishal | last post by:
i am getting following error. Warning: mail() : Failed to connect to mailserver at "smtp.gmail.com" port 465, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in...
1
by: tencip | last post by:
Hey everyone, We've got FreeBSD 5.3, with Sendmail running. All we want to do is to get sendmail to send emails to another server for actual outbound email. We've got a very basic php script...
0
by: chris.huh | last post by:
I have setup Apache and PHP on my local machine as a testing server. So to test the mail() function i have set the SMTP_host thing in php.ini to what i think is the hotmail SMTP server. Whenever...
11
by: Lieven | last post by:
Hey, I had a hard disc problem last week on my server. I replaced the disc and copied al the files to the new hard disc, everything works fine again except some php scripts that are using the...
13
Nert
by: Nert | last post by:
hello every one, i need help.. how can i use the mail() funtion in php? when ever i execute the mail function i continuesly receive this error message: what do i need to do in order for me...
9
by: shror | last post by:
hi every body, i have a problem which is when i was checking my mail() form it work fine but the problem is that the form configuration is not set correctly, in details: the from var is not...
8
by: anandaraman | last post by:
Hi all, i want to send mail through php coding.but error displays. i am working in windows environment. please help.. PHP Coding: <?php $to = "anandh@yahoo.com"; $subject = "Example"; $txt =...
2
by: Ronald Raygun | last post by:
I am calling the mail() function in a PHP script and I get the ff error: Warning: mail() : SMTP server response: 501 5.5.4 Invalid Address in C:\test\test.php on line 394 Relevant Info: OS:...
1
by: simon2x1 | last post by:
the code below is a code given to me to solve the problem of my mail going in to spam but i have a problem with line 16 how can i fix it and what should i do i will appreciate if u will edit the...
1
by: lisa007 | last post by:
Warning: mail() : SMTP server response: 503 valid RCPT command must precede DATA on whenever user click on to get new password but doesnt fill in the username field it shows that message i have...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.