PHP Error upon Form Send

Ah, thats simple enough :wink:


$To = 'me@mydomain.com';
$Subject = 'Test email';
$Message = 'This is a test email';

if (mail($To, $Subject, $Message);)
   {
   print 'Mail sent';
   }
else
   {
   print 'No email sent';
   }

Do I place this code within the page, within submit.php where :slight_smile: ?

That depends on your script. You put the code where ever it is in your script that you need the email to be sent. Just remember to change the values for what you want to be sent :wink:

I already have code where the email should be sent !?!??!

Without seeing your code there is no way to know that.

Please post your code wrapped in

 tags.

<?php
$s = @mail( 'to@address.com', 'Subject line..', 'The message' ); 
echo $s ? 'Sent' : 'Failed';   
?>

those two lines can be used to send an email from your server and get a basic response.

your code requires a class called PHPMailer, which is a php file, just like your submit.php. You need to download it and upload to your server if you intend to use it, no need to install anything.

PHPMailer Class

try that…

I have submit.php or contact-header.php or contact-footer.php ? I can’t install PHPMailer, as mentioned in a earlier post I can use mail() which is what me and tango are discussing.

Why can’t you ‘install’ it? - You have access to the files via ftp right? - thats all you’d need to do with phpmailer - upload it. You dont need to install it, you just need to put it there so your script can open it.

You say to just upload it, which I did but I still get this error:

Warning: require(phpmailer/class.phpmailer.php) [function.require]: failed to open stream: No such file or directory in /home/thecreat/public_html/construction/submit.php on line 2

Just to clarify:

  1. Is the file called class.phpmailer.php?
  2. Did you create and put it into a directory called phpmailer?

-T

I did do that, it breaks the page when I click send, the ‘message sent’ message doesn’t happen.

Ok, too late for me to help now, (2am here almost and i’m just off to bed) but google Teamviewer and download it. It will allow me to connect to your computer and see your desktop (I think it’s PC/Windows only).

Tomorrow, assuming you’re happy with that, we’ll fix up a time and i’ll connect to your desktop and take a look with you and try to get it working :wink:

Alright
What Time Zone are you in ?

I’m GMT/London it’s 12:10 here now. When are you about? - I’m around pretty much all day.

Could you try to tell me what I’m doing wrong so I can see for myself first ? :slight_smile:

If i knew, i wouldn’t be suggesting you let me try to debug it:rolleyes:

I’m going to install TeamViewer shortly I will update this thread soon.

Ready when you are…

Don’t update this thread, PM me your connection details so you know it is me connecting.

I only updated to let you know I was ready :slight_smile: Not to announce it publically :slight_smile:

Emails are now working after a debug session via TeamViewer.