14 Replies - 1859 Views - Last Post: 30 January 2011 - 02:24 PM Rate Topic: -----

#1 Ntwiles  Icon User is offline

  • D.I.C Addict

Reputation: 148
  • View blog
  • Posts: 830
  • Joined: 26-May 10

Mail Function?

Posted 29 January 2011 - 05:58 PM

I'm trying to write some code that will send out an email containing an activation code for new members. No emails seem to be going out though. I'm having trouble figuring out a way to check exactly what the problem is. Here's how I'm implementing the function:

     
$email = $_POST['email'];
$to = $email;
$subject = "TheBlog Registration";
$message = "Test Email";

$headers = 'From: noreply@theblog.x10.mx' . "\r\n" . 'Reply-To: noreply@theblox.x10.mx' . "\r\n" . 'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);


I don't actually have an email address set up at noreply@theblog.x10.mx. Does this have to be an existing address? If not, can anyone tell me what my mistake is?

This post has been edited by Ntwiles: 29 January 2011 - 05:59 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Mail Function?

#2 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 926
  • View blog
  • Posts: 3,205
  • Joined: 19-January 10

Re: Mail Function?

Posted 29 January 2011 - 06:37 PM

I'm sure mail will return a boolean. Check it see if its failing to send (false). Also check your spam/junk folder. I think some email services block these emails (I know Yahoo doesn't).
Was This Post Helpful? 1
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6058
  • View blog
  • Posts: 23,496
  • Joined: 23-August 08

Re: Mail Function?

Posted 29 January 2011 - 07:07 PM

Yes, you have to have an email server to which to send, which will relay your mail to the destination.
Was This Post Helpful? 1
  • +
  • -

#4 Ntwiles  Icon User is offline

  • D.I.C Addict

Reputation: 148
  • View blog
  • Posts: 830
  • Joined: 26-May 10

Re: Mail Function?

Posted 29 January 2011 - 07:14 PM

Thanks for the replies guys. Mail is returning true, it thinks it's sending the email out ok.

My host has an email server set up I'm sure. Do I need to set up the specific address noreply@ in cPanel though?
Was This Post Helpful? 0
  • +
  • -

#5 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5247
  • View blog
  • Posts: 27,071
  • Joined: 10-May 07

Re: Mail Function?

Posted 29 January 2011 - 07:17 PM

Check your web server logs.
That is to so...

I would check the Apache logs (both system & specific access & error logs for the domain) as well as logs for the smtp mail that the server uses.
Was This Post Helpful? 0
  • +
  • -

#6 Ntwiles  Icon User is offline

  • D.I.C Addict

Reputation: 148
  • View blog
  • Posts: 830
  • Joined: 26-May 10

Re: Mail Function?

Posted 29 January 2011 - 07:20 PM

I've never done that, what am I looking for exactly? In cPanel I see Bandwidth, Raw Access Logs, and Error logs, none of which seem to have anything for me to view.
Was This Post Helpful? 0
  • +
  • -

#7 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5247
  • View blog
  • Posts: 27,071
  • Joined: 10-May 07

Re: Mail Function?

Posted 29 January 2011 - 07:22 PM

View Postcreativecoding, on 29 January 2011 - 08:37 PM, said:

I'm sure mail will return a boolean.

The php mail command is a boolean, however it isn't an MTA. It doesn't care what happens with the email. In a basic description it simply outputs data to port 25 (on the server) with a destination for the internet. It has no way of checking what happens to the data once it leaves the server. This means the ISP could drop it's outbound traffic request, the destination could trash it, anything can happen with the email & php's mail function doesn't care. It sent it, end of it's responsibility.
Was This Post Helpful? 1
  • +
  • -

#8 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5247
  • View blog
  • Posts: 27,071
  • Joined: 10-May 07

Re: Mail Function?

Posted 29 January 2011 - 07:28 PM

Who do you host with? It's possible that the only allow mail on a package base.

I had a client once that had a complaint about GoDaddy randomly holding their emails sometimes, checking for spam. There was no control over it.
Was This Post Helpful? 0
  • +
  • -

#9 Ntwiles  Icon User is offline

  • D.I.C Addict

Reputation: 148
  • View blog
  • Posts: 830
  • Joined: 26-May 10

Re: Mail Function?

Posted 29 January 2011 - 07:33 PM

I'm using a free host while developing the site. It's x10.mx/x10hosting.com. I'm not sure what you mean by 'on a package base'. Is there any way I can find out if that's the issue?

This post has been edited by Ntwiles: 29 January 2011 - 07:33 PM

Was This Post Helpful? 0
  • +
  • -

#10 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5247
  • View blog
  • Posts: 27,071
  • Joined: 10-May 07

Re: Mail Function?

Posted 29 January 2011 - 07:37 PM

View PostNtwiles, on 29 January 2011 - 09:33 PM, said:

Is there any way I can find out if that's the issue?

Check their terms of service or phone their customer support

Most likely since you have to ask, & the function is checking succesfull but you are seeing no mail (even in spam), I think it's a safe bet to assume it's in fact not included.
Was This Post Helpful? 0
  • +
  • -

#11 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 926
  • View blog
  • Posts: 3,205
  • Joined: 19-January 10

Re: Mail Function?

Posted 29 January 2011 - 08:02 PM

http://x10hosting.co...ting-comparison

It supports mail. Did you try to send it to other mailing services?
Was This Post Helpful? 1
  • +
  • -

#12 Ntwiles  Icon User is offline

  • D.I.C Addict

Reputation: 148
  • View blog
  • Posts: 830
  • Joined: 26-May 10

Re: Mail Function?

Posted 29 January 2011 - 08:19 PM

Thanks creativecoding I was going to give up until you found that.

I just created a yahoo account and the email went through just fine to that address. I've sent about 5 emails to 2 different hotmail addresses and none of them have went to the inbox or the junk mail folder. Why could this be happening?

This post has been edited by Ntwiles: 29 January 2011 - 08:19 PM

Was This Post Helpful? 0
  • +
  • -

#13 creativecoding  Icon User is offline

  • Hash != Encryption
  • member icon


Reputation: 926
  • View blog
  • Posts: 3,205
  • Joined: 19-January 10

Re: Mail Function?

Posted 29 January 2011 - 11:39 PM

Perhaps it's just the two email addresses you have registered? Make another one and see if you still have the same problem. If the problem continues, ask Google support for help.

This post has been edited by creativecoding: 29 January 2011 - 11:45 PM

Was This Post Helpful? 0
  • +
  • -

#14 Ntwiles  Icon User is offline

  • D.I.C Addict

Reputation: 148
  • View blog
  • Posts: 830
  • Joined: 26-May 10

Re: Mail Function?

Posted 30 January 2011 - 02:03 PM

I've made a third one and still no go. I've created a thread on some crappy about.com hosted hotmail support forum, but I don't even expect to get a response from that. Does anyone know what could be doing this? Is there something I've added or something I'm missing that is causing hotmail to filter out this email for some reason?
Was This Post Helpful? 0
  • +
  • -

#15 Valek  Icon User is offline

  • The Real Skynet
  • member icon

Reputation: 542
  • View blog
  • Posts: 1,713
  • Joined: 08-November 08

Re: Mail Function?

Posted 30 January 2011 - 02:24 PM

Try PHPMailer and see if it works with that. If you still have issues sending to Hotmail, you should consider the possibility that Hotmail has your free hosting provider blacklisted on its mail servers (which is actually fairly likely, as free hosting is often used to send out mass spam e-mails).
Was This Post Helpful? 3
  • +
  • -

Page 1 of 1