473,463 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

mail() not sending email

I found the following code and I successfully get the "Your message was sent" message, but no email was actually sent. I checked the spam filter. I work in Notepad++ and I noticed that the word "mail" is not being seen as a function (function words show up blue), but as text (black lettering). Any suggestions?
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if ($_POST["email"]<>'') {
  3.     $ToEmail = 'itsupport@povpc.org';
  4.     $EmailSubject = 'CPM Database Updates Form';
  5.     $mailheader = "From: ".$_POST["email"]."rn";
  6.     $mailheader .= "Reply-To: ".$_POST["email"]."rn";
  7.     $mailheader .= "Content-type: text/html; charset=iso-8859-1rn";
  8.     $MESSAGE_BODY = "Name: ".$_POST["name"]."";
  9.     $MESSAGE_BODY .= "Email: ".$_POST["email"]."";
  10.     $MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])."";
  11.     mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");
  12. ?>
  13. Your message was sent
  14. <?php
  15. } else {
  16. ?>
  17. <form action="email.php" method="post">
  18. <table width="400" border="0" cellspacing="2" cellpadding="0">
  19. <tr>
  20. <td colspan="2"><p>Please fill in the form below and your records will be updated as soon as possible.</p></td>
  21. </tr>
  22. <tr>
  23. <td width="29%" class="bodytext">Your name:</td>
  24. <td width="71%"><input name="name" type="text" id="name" size="32"></td>
  25. </tr>
  26. <tr>
  27. <td class="bodytext">Email address:</td>
  28. <td><input name="email" type="text" id="email" size="32"></td>
  29. </tr>
  30. <tr>
  31. <td class="bodytext">Comment:</td>
  32. <td><textarea name="comment" cols="45" rows="6" id="comment" class="bodytext"></textarea></td>
  33. </tr>
  34. <tr>
  35. <td class="bodytext"> </td>
  36. <td align="left" valign="top"><input type="submit" name="Submit" value="Send"></td>
  37. </tr>
  38. </table>
  39. </form>
  40. <?php
  41. };
  42. ?>
  43.  
Mar 22 '12 #1
1 1384
Dormilich
8,658 Expert Mod 8TB
I work in Notepad++ and I noticed that the word "mail" is not being seen as a function (function words show up blue), but as text (black lettering).
that's irrelevant to PHP. if a function does not exist, it will complain.

as is commonly known, a successful call to mail() does not guarantee the mail to be sent, only to be delivered to your mail sending binary (usually an instance of sendmail). if sending the mail is successful or not is out of the scope of mail().

if you want reliable sending of mails, use a mailing library (e.g. SwiftMailer)
Mar 22 '12 #2

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

Similar topics

0
by: praba kar | last post by:
Dear All, I have doubt regarding mail sending smtplib module. The below code is I used to send a mail. ########################################## import email.Message import email.Utils...
13
by: joe215 | last post by:
I want my users to send emails from a Windows app that I am developing in Visual Basic.NET 2003. I found a good example of sending email to a SMTP server using the SmtpMail class. However, using...
17
by: Bonj | last post by:
Right guys. (I would like a solution to this in VB6 as this is what our needy app is written in, but any solutions that involve .NET would be much appreciated likewise as I could instantiate...
6
by: Eduardo Rosa | last post by:
Somebody knows how I queue email using .Net? thanks a lot
8
by: Frank | last post by:
I think I've confused myself completely here :-) I have used System.Web.Mail, but am not sure if this works with Exchange Server 5.5. I asked the client if they're email server supported SMTP, and...
2
by: ChrisA | last post by:
I'm sending email from my ASP.NET 1.1 app, and it works fine providing the BodyFormat of the System.Web.Mail.MailMessage is set to Text. If I change to Html format, it breaks. Here's the code: ...
3
by: armando perez | last post by:
Hi, this is my first time here, but I was looking for something that may help me, and still, I haven't found something to use. I'm using a website made in .NET with C#, when I'm running my site...
9
by: -Nacho- | last post by:
Hi all I have a table with some email addresses of a mailing list subscribers. I'm triying to send a mail to them by querying the table and sending the mail from a 'while' loop, but I only get...
1
by: xin.yadong | last post by:
Hi: I have a shared function for sending Email using SMTP. It works fine in a ASP.NET web application. But when I use it in a VB.Net Windows application, it always gave me an error: "Could not...
31
by: happyse27 | last post by:
Hi All, I am trying for weeks how to send email from windows pc, which from my gmail account to my hotmail account. Using net::smtp module sending email failed,Kindly assist. (for the item d it...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.