Jump to content


Photo

what is the problem?


  • Please log in to reply
19 replies to this topic

#1 pluginbaby

pluginbaby
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 19 August 2006 - 12:48 PM

<?php

$to      = 'willem_sterckx2@hotmail.com';
$subject = 'test';
$message = 'hello';

mail($to, $subject, $message);
echo "email send";
?>

I used this piece of code to test that an email would be send to my if I run it.
I run it and it gives me the message: "email send". When I look in my inbox there is nothing there.

I checked if the email address is correct, and it is.
I waited 24 hours for the email to arrive, and still nothing.
I have send the email more then 1 time, so it should be there...

What can the problem be then?

#2 Yesideez

Yesideez
  • Members
  • PipPipPip
  • Advanced Member
  • 2,334 posts
  • LocationDevon, UK

Posted 19 August 2006 - 12:56 PM

Have you checked the junk inbox of your hotmail account its being sent to? I've found emails generated by my scripts often end up there.
Not a pro just an enthusiast :)

if (empty($coffee)) {$coffee=new coffee();}

Please surround any code using the CODE tags - I rarely look at anything without them

#3 pluginbaby

pluginbaby
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 19 August 2006 - 12:58 PM

checked a couple of times, but none of them are in there...  :(

#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 19 August 2006 - 01:01 PM

Most email programs expect to see a "From:" header or they will toss the email down the bit bucket. Add at least the fourth parameter to the mail() function:

<?php
$to      = 'willem_sterckx2@hotmail.com';
$subject = 'test';
$message = 'hello';
$headers = 'From: youremail@address.here';

if (mail($to, $subject, $message,$headers)) echo "email send";
?>
Note: A successful return from the mail() function just means that your message was queued to be sent, not that it was sent successfully.

Also, hotmail.com has been notorious for filtering out email messages and not telling about it. If you have another email address you can use to test with, try that one.

Ken

#5 pluginbaby

pluginbaby
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 19 August 2006 - 01:09 PM

Okay, I tried with the "From ..." thing.

Still got nothing in my inbox...

Anyway, I want to use this for a registration. You register and an activation is send to your email address. If this doesn't work on hotmail, there is no point of building that, since a lot of people I know only have hotmail. :o

#6 pluginbaby

pluginbaby
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 19 August 2006 - 01:15 PM

I used a yahoo email address, and now I got the email.

Is there any way I can solve this problem that hotmail accounts also get the email?

#7 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 19 August 2006 - 01:40 PM

If you are using a shared host on a Linux (UNIX) box, you probably also need to use the fifth parameter to the mail() function. This parameter sets the "Return-path:" header. If the domain in that header doesn't match the domain of the address in the "From:" header hotmail.com will toss the email.

The fifth parameter looks like:
<?php $p5  = '-f youraddress@yourdomain.com'; ?>
and is used like
<?php mail($to,$subject,$msg,$headers,$p5); ?>

Ken

#8 pluginbaby

pluginbaby
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 19 August 2006 - 01:58 PM

okay, I have added the 5th parameter:

<?php
$to      = 'willem_sterckx@hotmail.com';
$subject = 'test';
$message = 'hello';
$headers = 'From: superadmin@billshakesphere.de';
$p5  = '-f superadmin@billshakesphere.de';

if (mail($to,$subject,$msg,$headers,$p5)) echo "email send";
?>

But when I runned it, I got this error:

Warning: mail() [function.mail]: SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE. in /srv/www/htdocs/web34/html/test.php on line 8


What can I do about that then?

#9 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 19 August 2006 - 02:03 PM

here is another example of a simple one. You may want to read up on the use of the headers in the mail.

mail($to, $subject, $message, "From: You<you@yoursite.com>\nX-Mailer: PHP/" . phpversion());

Give this a try

Hope this helps,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#10 pluginbaby

pluginbaby
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 19 August 2006 - 02:15 PM

sorry to dissapoint you but I still haven't got anything in my hotmail inbox or trash can.

I think there must be a way of doing it, cause if you register on a forum, you get an email too if you are using a hotmail account.

Anyone has some more ideas?

#11 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 19 August 2006 - 02:23 PM

Not sure. I would contact my host if I were you. Do you know what mail server they are using? If not I would send them an email with your issue.

This script that I posted is a functional
mail();
format. Is is very basic but should work.

Good luck,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#12 pluginbaby

pluginbaby
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 19 August 2006 - 02:27 PM

well, it does work. But not with a @hotmail adres.

When I send it to my ...@yahoo.com it works. But when I send it at my ...@hotmail.com it doesn't work. What I want is that it works also on the @hotmail.com email address, cause the site where I want to use it for has a lot @hotmail.com email addresses, and if they can't recieve the email, there is no use of me creating this ;)

I hope you understand my problem and there is a way of fixing it...

#13 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 19 August 2006 - 02:33 PM

You know I have the same issue. And have yet to fix it.


I will do some testing and see what I can come up with.


Good Luck,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#14 pluginbaby

pluginbaby
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 19 August 2006 - 02:36 PM

thank you, it would be wonderful if someone found a solution  ;D

#15 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 19 August 2006 - 02:37 PM

http://forums.whirlp...cfm/484996.html
Legend has it that reading the manual never killed anyone.
My site

#16 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 19 August 2006 - 02:40 PM

Ok I tried this and it worked

if ($ccaddress=="" || $ccaddress==" "){
	$header="From: $knownsender";
	
}else{
	$header .="From: $knownsender\r\n";
	$header .=" Cc: $ccaddress";
}
// $header.="Bcc: $bcaddress";

if (@mail($mailtos, $subject, $message, $header)){
	echo "Your Email has been sent.";
}else{
	echo "There was an error sending your Email";
}

$knownsender is an email address that is known to the server. I never thought to use this but it works just fine.

Give it a try.


Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#17 pluginbaby

pluginbaby
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 19 August 2006 - 03:07 PM

Hmm, I must be doing something wrong then:

<?php
$mailtos = "willem_sterckx2@hotmail.com";
$subject = "test";
$message = "this is a testingmessage";
$knownsender = "willem_sterckx2@hotmail.com";

if ($ccaddress=="" || $ccaddress==" "){
	$header="From: $knownsender";
}else{
	$header .="From: $knownsender\r\n";
	$header .=" Cc: $ccaddress";
}
// $header.="Bcc: $bcaddress";

if (@mail($mailtos, $subject, $message, $header)){
	echo "Your Email has been sent.";
}else{
	echo "There was an error sending your Email";
}
?>

This is the exact code I executed, but I didn't got any emails at my hotmail account, I was wondering, is the "$knownsender" correct?

#18 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 19 August 2006 - 03:12 PM

Use an email address that is known to the server. Like you@yoursite.com

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#19 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 19 August 2006 - 04:33 PM

Make sure the domain portion of the "From:" address and the address in the fifth parameter is the same as the domain that is sending the email message.

Ken

#20 pluginbaby

pluginbaby
  • Members
  • PipPipPip
  • Advanced Member
  • 37 posts

Posted 19 August 2006 - 04:55 PM

I did it without the 5th parameter. It works without it to.

I set up an email address at my domain called: automailer@....
I also changed the subject of my email, maybe MSN sees "test" as a spam subject.

Anyway, now it finally arrived. I tested a couple of times and it keeps working.

Thank you all of you for helping me out on this one ;D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users