mail scripts won't work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
goltoof
Forum Newbie
Posts: 3
Joined: Wed Apr 18, 2007 9:29 pm

mail scripts won't work

Post by goltoof »

I've been tearing my hair out for 3 days now over something that some 12 year old could probably do in 10 minutes in his sleep.

My Joomla site sends mail just fine, but I can't even get the simplest php script to send mail. By simplest I mean

Code: Select all

<?php
$txt = "Some text";

mail ("my@email.com","Test subject",$txt);
?> 
I'm using Ubuntu server, sendmail is all configured. Joomla sends just fine, I'm trying to send from a simple form on a webpage outside of Joomla which brings me to believe that there's something I'm not including in the script that it needs to work.

Can you break down each thing that I should check on the server and each thing I should include in the script to just make it work?
internet-solution
Forum Contributor
Posts: 220
Joined: Thu May 27, 2010 6:27 am
Location: UK

Re: mail scripts won't work

Post by internet-solution »

To start with, check the return value from mail()

Code: Select all

$mailReturn=mail ("my@email.com","Test subject",$txt);
echo $mailReturn;
and post the result here.
goltoof
Forum Newbie
Posts: 3
Joined: Wed Apr 18, 2007 9:29 pm

Re: mail scripts won't work

Post by goltoof »

internet-solution wrote:post the result here.
1
internet-solution
Forum Contributor
Posts: 220
Joined: Thu May 27, 2010 6:27 am
Location: UK

Re: mail scripts won't work

Post by internet-solution »

Then the mail is accepted for delivery. Use 'mailq -v' in ubuntu shell to check mail que. If nothing in the que then check your spam folder.
Post Reply