Solved

trouble shooting mail.

Posted on 2010-11-12
17
377 Views
Last Modified: 2013-12-12
I don't receive mail to my home me@here.net address, but I do receive mail at my me@gmail.com address. I delete the comments // on the address when I test.
Actually I did receive mail at my home address I think twice over the last few days and about 30 tests, but I cannot narrow down the reason. I wonder if it has something to do with a service providers security policy or the php.ini file.

How should I trouble shoot this? Thanks.

<?php

error_reporting(E_ALL);

      //$email = "me@here.net";
      $email = "me@gmail.com";

      $to = $email;
      $subject = "Your subject";
        $message = "Your message \r\n";
      $header = "from: your name <test@test.com>";       
      
      $sentmail = mail($to,$subject,$message,$header);

      print_r($sentmail);
            
?>
0
Comment
Question by:kadin
  • 8
  • 4
  • 3
  • +1
17 Comments
 
LVL 57

Expert Comment

by:giltjr
ID: 34123608
Do you comment out

    $email = "me@gmail.com";

When you uncomment:

    //$email = "me@here.net";


If not then when the second $email is interpreted  it replaces me@gmail.com with me@here.net.

Do you want it to go to just one of the e-mail addresses, or do you need it to go to both?


0
 

Author Comment

by:kadin
ID: 34123738
Yes. I swap the comments to test each one.

I want a user filling out my form to add what ever email address they have and be able to send them a response. Like a confirmation.
0
 
LVL 10

Expert Comment

by:Tyler Laczko
ID: 34123864
Confirm that you are uploading your new changes to your webserver.

Also clear your cache from your browser.

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Expert Comment

by:Tyler Laczko
ID: 34123874
you can use    SHIFT+F5   to reload your page. but make sure you are reloading the page that has the mailing script.
0
 
LVL 57

Expert Comment

by:giltjr
ID: 34123906
I agree with professionalc… comments,  make sure that you are uploading/saving the changes on the web server and make sure you are clearing the cache on the client.

Not that it would matter that much but instead of having:

      $email = "me@gmail.com";
      $to = $email;
     
      $sentmail = mail($to,$subject,$message,$header);

You could just have:

      $email = "me@gmail.com";
      $sentmail = mail($email,$subject,$message,$header);

Of course all other other code need to stay there, but there is no real reason to "copy" $email to $to.  It not a whole lot of savings, but it is one less function to do and one less variable.

0
 

Author Comment

by:kadin
ID: 34123976
I cleared the cache and reloaded the page. I confirmed the correct updated file was being moved to the server.

Here is what I tried just now.  print_r($sentmail); prints 1. I guess that means it sent, but I never receive.

<?php

error_reporting(E_ALL);

      $email = "me@here.net";
      //$email = "me@gmail.com";

      $to = $email;
      $subject = "Your subject";
        $message = "Your message \r\n";
      $header = "from: your name <test@test.com>";      
     
      $sentmail = mail($to,$subject,$message,$header);

      print_r($sentmail);
           
?>
0
 
LVL 57

Expert Comment

by:giltjr
ID: 34124005
Do you any any junk/spam filters?

Try changing he subject.
0
 

Author Comment

by:kadin
ID: 34124072
I checked my Norton Anti Spam folder and it is empty.

I looked for any settings in Norton last night that might be responsible and did not see any.
0
 

Author Comment

by:kadin
ID: 34124096
My email is working. I can send and receive from my home address.
0
 
LVL 10

Expert Comment

by:Tyler Laczko
ID: 34124228
add this to your code at the bottom:

echo "$to,$subject,$message,$header";
0
 

Author Comment

by:kadin
ID: 34124341

The web page draws this.

1me@here.net,Your subject,Your message ,from: your name
0
 

Author Comment

by:kadin
ID: 34124553
I tried emailing to my dads .net address and he receives nothing. But still my gmail.com account receives successfully.

A few weeks ago my hosting company moved or copied the php.ini file to a location where I have access to it. I wonder if there is a setting in that file that matters or whether its location makes a difference.
0
 
LVL 10

Expert Comment

by:Tyler Laczko
ID: 34124585
make sure you are sending from a valid address / name
your email system may be blocking it.
0
 

Author Comment

by:kadin
ID: 34124643
How do I do that?

Do I add some thing to my email script?
0
 
LVL 20

Accepted Solution

by:
Mark Brady earned 500 total points
ID: 34128639
kadin

I had the same problem with an email script I wrote similar to yours. I could use it to send mail to any of my email addresses EXCEPT my primary one from my service provider myemail@xtra.co.nz

I trouble shooted this script but it was written properly and only my main email address would not deliver the email, so, after searching google for days, it turns out I went to my email account via webmail. Instead of using my usual rcomputers email client I used webmail. I tested by sending a test email to myself and rechecking, and the test came through so I knew it was working.

I then checked my spam folder and there were about 30 emails that my script had sent. The spam folder had captured them all. This didn't make sense because I had even added the websites email address to my address book (the address in the "from" field).

I contacted the service provider (xtra.co.nz) which was bought out by non other than Yahoo.com and it seems that yahoo have added a bunch of very strict email filters. Because they were seeing more than 1 email come from my website in a space of 1 hours, they automatically added the domain name of my website to their blacklist which means that ANY user that uses xtra.co.nz or yahoo.com would not be able to get email from my domain or website.

I had to apply in writing to them filling out several forms to get my domain taken off their blacklist.

Now, one thing to keep in mind here is I did actually recieve 1 or 2 of the very first testing emails as I was changing the format so I knew it was working. Only after about 2 emails did I stop getting them. That would have been when Yahoo's software captured my domain name and blacklisted me.

I guess in a long winded way, I'm trying to tell you to

1: Thoroughly check your spam folder both locally AND your online spam folder if you have webmail.
2: If you have another domain or another website on a different server you could test it on there and see if you get the mail.
3: You could always post your complete script here and we will test it on our websites and see if we get the emails.

There is nothing wrong with your script programatically so it should work 100% of the time. I think your provider is the one who holds the answer here.
0
 

Author Comment

by:kadin
ID: 34129085
Elvin66 and all of you who tried to help me, thank you.

I found out why it was not working and came back here to explain when I read a new comment. What happened to Elvin66 is mostly what happened to me.

My hosting company told me to contact my internet service provider which is at&t formally sbcglobal, so I did. She showed me there are two spam folders. One in my email client program and one at a website controlled by Yahoo. I guess most of the spam is filtered and collected at yahoos website. And there they were, all my test emails.

There is a uncheck setting to make all the spam go to my email client which I did and now I receive emails from my script. I do remember receiving 1 or 2 emails when I was first testing my script, so maybe I was black listed.

I may try writing them at some point as you did to remove me from their black list.

Thanks again.
0
 
LVL 20

Expert Comment

by:Mark Brady
ID: 34130013
You're welcome. It just sounded so familiar and when I saw your script I knew it was not the code itself but more of an email provider issue. I'm glad you got it sorted. Dealing with Yahoo is one of the most frustrating things on this planet to do but you will have to do it to get off their blacklist.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Undefined variable problem 5 32
i am unable to add data to mysql database 6 48
CURL sending XML without spaces PHP 5 28
MySQL-Design Help 12 38
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question