473,385 Members | 1,312 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,385 software developers and data experts.

PHP Problems - Sending Mail from Form

Hi - Not sure if this is exactly the right forum to enter this is - but need to start somewhere as I don't know where it's not working.

I have a contact form on a flash website, when the submit button is pressed, another window opens to say the mail has been sent - when it hasn't (Ihave changed this to read there was a problem). I can't see anything in the logfiles to say what hasn't worked - but it's driving me crazy. The file called upon is contact.php which is why I'm here;

Expand|Select|Wrap|Line Numbers
  1. <?
  2. Error_Reporting(E_ALL & ~E_NOTICE);
  3.  
  4.  while ($request = current($_REQUEST)) {
  5.      if (key($_REQUEST)!='recipient') {
  6.         $pre_array=split ("&777&",  $request);
  7.         $post_vars[key($_REQUEST)][0]=$pre_array[0];
  8.         $post_vars[key($_REQUEST)][1]=$pre_array[1];
  9.     }
  10.     next($_REQUEST);
  11. }
  12.  
  13.  
  14.  
  15. reset($post_vars);
  16.  
  17. $sendTo ="Web@email.co.uk" ;
  18. $subject="From ".$post_vars['your_name'][0] ;
  19. $headers="From: ".$post_vars['your_email'][0] ."\n";
  20. $headers.='Content-type: text/html; charset=iso-8859-1';
  21. $message='';
  22.   while ($mess = current($post_vars)) {
  23.       if ((key($post_vars)!="i") && (key($post_vars)!="your_email") && (key($post_vars)!="your_name")) {
  24.  
  25.          $message.="<strong>".$mess[1]."</strong>&nbsp;&nbsp;&nbsp;".$mess[0]."<br>";
  26.     }
  27.     next($post_vars);
  28.  }
  29.  
  30. mail($sendTo, $subject, $message. $headers);
  31. echo ("There was a problem sending the email - sorry for the inconvenience");
  32.  
  33. ?>
  34.  
Expand|Select|Wrap|Line Numbers
  1. <script>
  2.     resizeTo(450, 300);
  3. </script>
  4.  
Can anyone help? Do you need anymore information?

Thanks
TB
Sep 28 '08 #1
3 1462
dlynx
3
Not too sure, but your code looks wrong, the error message should fire all the time successful or otherwise. In any case, the built-in mail function is not really a very good sender.

<removed advertising>
Oct 1 '08 #2
maheswaran
190 100+
Not sure..may u try with
[code=php]
if(! mail($sendTo, $subject, $message. $headers))
{
echo ("There was a problem sending the email - sorry for the inconvenience");
}
[/php]
Oct 1 '08 #3
The error message does come up all the time- I changed the text as it used to say "thanks - your mail has been sent succesfully" - when it hadn't.

The problem is the message does not send or I don't get it - and I've got no idea how to make it work - happy to have it saying thanks - your mail has been sent succesfully" when I know it's going to get to me.
Oct 3 '08 #4

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

Similar topics

1
by: Stephajn Craig | last post by:
It's been a while since I posted here, but here goes. Our server is a Windows 2000 Server with Service Pack 3, IIS 5 with Lockdown Wizard applied. My first problem is related to...
5
by: Kelli | last post by:
Hi there, I'm wondering if someone can have a quick look at my code and see if there's anything that I've done wrong. This silly script is driving me crazy! <% DIM File, Upload, Count,...
3
by: Matthew Loraditch | last post by:
I have a form mail processor from brainjar.com, I am using.(http://www.brainjar.com/asp/formmail/) I have modified it slightly to do some things. I am trying to get it to cc a copy of the email it...
2
by: Rene | last post by:
Hi all i need some help. i try to send mail with the following code. Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click Dim...
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...
2
by: prasenjit2007 | last post by:
Hello, can u help me sending Email with attachments using the Class phpMailer. On the website I have a link to an html form in which I input the parameters with the names 1)from(textbox name)...
2
by: mister-Ed | last post by:
Trying to use cdosys mail, but this is giving me an "no such object" error. the hosting company is not much help, but their list of components offered does include cdosys mail: <form...
4
by: =?Utf-8?B?R3V5IENvaGVu?= | last post by:
Hi all I use: Dim message As New MailMessage(txtTo.Text, txtFrom.Text, txtSubject.Text, txtBody.Text) Dim emailClient As New SmtpClient(txtSMTPServer.Text) emailClient.Send(message) And its...
7
by: bleachie | last post by:
Hey, I just need some help, my form seems to not send me all of the 'guestNames' and 'guestEmails' forms. i use this function to add more guestnames and guestemail fields based on the number of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.