Current location: Hot Scripts Forums » Programming Languages » PHP » mail script


mail script

Reply
  #1 (permalink)  
Old 04-21-09, 06:08 PM
tommyc325's Avatar
tommyc325 tommyc325 is offline
Wannabe Coder
 
Join Date: Sep 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
mail script

is there a reason why this email script is taking forever to get into my inbox

PHP Code:

<?php



$email 
"myemail@gmail.com";
$subject "this is my subject";
$message "this is my message";
$from "whoItsComing@from.com";

$headers "From: ".$from;

mail($email,$subject,$message,$headers)


?>
Reply With Quote
  #2 (permalink)  
Old 04-21-09, 06:43 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
Is it sending at all?

You should also have a " ; " at the end of your mail() line.
Reply With Quote
  #3 (permalink)  
Old 04-21-09, 06:45 PM
tommyc325's Avatar
tommyc325 tommyc325 is offline
Wannabe Coder
 
Join Date: Sep 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
yes it is sending
Reply With Quote
  #4 (permalink)  
Old 04-21-09, 07:32 PM
dgreenhouse's Avatar
dgreenhouse dgreenhouse is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: San Francisco
Posts: 457
Thanks: 0
Thanked 3 Times in 3 Posts
It could be any number of reasons.

Most probably it's on your mail server's end, but it could be gmail's server's bouncing
around the email until they decide to deliver it.

Could be due to previous grey-listing (wouldn't be black-listing because it probably wouldn't get through at all).
- Or - It might be bouncing around in other servers along the way.
- Or - Could also be due the time of day or other Internet-related traffic congestion issues.

But as stated, it's probably on your server's end - especially if you're on a shared host.

On your end, they might be sending emails from a server that's not their main smtp/imap server.

They probably have numerous servers feeding their main email servers and the mail takes a
long time to route internally. Best to talk to tech support and ask them.

Maybe they can recommend a better route / headers for outgoing mail from your server.
Reply With Quote
  #5 (permalink)  
Old 04-21-09, 07:33 PM
tommyc325's Avatar
tommyc325 tommyc325 is offline
Wannabe Coder
 
Join Date: Sep 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
thats what i thought thanks guys
Reply With Quote
  #6 (permalink)  
Old 04-22-09, 03:43 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
I suggest using PhpMailer to send emails. It includes all necessary headers and standards. So perhaps your mails get through a little faster this way.
Reply With Quote
  #7 (permalink)  
Old 04-25-09, 02:39 AM
dgreenhouse's Avatar
dgreenhouse dgreenhouse is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: San Francisco
Posts: 457
Thanks: 0
Thanked 3 Times in 3 Posts
Yep, I like PhpMailer too...

I've learned a lot about the standards by digging into that code base while reading the RFC's.
Reply With Quote
  #8 (permalink)  
Old 08-30-09, 09:32 PM
esandra esandra is offline
Newbie Coder
 
Join Date: Aug 2009
Posts: 47
Thanks: 1
Thanked 0 Times in 0 Posts
how do i choose the right phpmailer version for me, does the version matters at all? Because when I open the page these errors occur:
----------------------------------------------------------------------

Warning: Call-time pass-by-reference has been deprecated in /home/ftpclients/itproject/itproj04/phpMailer_v2.1/test/phpunit.php on line 115

Warning: Call-time pass-by-reference has been deprecated in /home/ftpclients/itproject/itproj04/phpMailer_v2.1/test/phpunit.php on line 150

Warning: Call-time pass-by-reference has been deprecated in /home/ftpclients/itproject/itproj04/phpMailer_v2.1/test/phpunit.php on line 231

Warning: Call-time pass-by-reference has been deprecated in /home/ftpclients/itproject/itproj04/phpMailer_v2.1/test/phpunit.php on line 295

Warning: Call-time pass-by-reference has been deprecated in /home/ftpclients/itproject/itproj04/phpMailer_v2.1/test/phpunit.php on line 295
----------------------------------------------------------------------
I've tried two versions and I think the errors are just the same, they are just not on the same line.
Reply With Quote
  #9 (permalink)  
Old 08-31-09, 03:35 AM
dgreenhouse's Avatar
dgreenhouse dgreenhouse is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: San Francisco
Posts: 457
Thanks: 0
Thanked 3 Times in 3 Posts
The simplest way to stop the warnings is to set: allow_call_time_pass_reference to TRUE in
your php.ini, but that's only a quick solution as you may have problems in future versions of PHP.

As noted in this sentence from the PHP docs:
"This method is deprecated in PHP 5.3.0 and is likely to be unsupported in future versions of PHP/Zend."

You can also change your error reporting level to quash the error notification.

Lastly; which is probably not the wisest as it might return if you upgrade phpMailer and they don't fix it the call in their code,
is to remove the ampersand preceding the passed arguments in errant the lines you've noted in your post.
(On the above, you might be: using an older version, the folks that put out phpMailer haven't modified the code or you're using the php4 version.)

RE: changing the code...
Code:
$welcome = "Hello World!";

echo badReferencePassed(&$welcome);  // This will cause a warning in new PHP 5.(something) versions


function badReferencePassed (&$var) // reference should only be defined in the function definition
{
  // do something...
  return $something_done;
}
This error won't keep the module from running.

As far as the version goes, just choose close to latest stable version for your version of PHP.

I can imagine it's pretty confusing since they have so many versions on SourceForge.

Hope that helps...

Last edited by dgreenhouse; 08-31-09 at 03:59 AM.
Reply With Quote
  #10 (permalink)  
Old 08-31-09, 05:13 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
As a general rule, the latest stable version is best.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Send mail authentication sujata_ghosh Perl 9 06-24-08 12:45 AM
Attachement help needed sujata_ghosh Perl 18 06-22-07 01:00 PM
ASP mail script samshf Script Requests 1 03-26-07 06:49 AM
script to get mail adresses from a text? BartHuis JavaScript 1 02-11-06 01:24 PM
mail acknowledgement script onlynils PHP 2 07-03-03 02:35 PM


All times are GMT -5. The time now is 08:32 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.