SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can only send email to my own domain

    I have a server that uses Plesk. I have set up a subdomain for testing and am trying to get a script to send an email to my yahoo account. The thing is it won't, no errors, no logs. If I send it to my own domain the email goes through. Anyone with any ideas.

    Here's my code
    PHP Code:
    <?php
    $to      
    'myemail@yahoo.co.uk'
    $subject 'Email Test';  
    $email_message 'This is to test sending an email';                              
    $headers 'From:contact@mydomain.co.uk' "\r\n"

    if (
    mail($to$subject$email_message$headers)) {
        echo 
    'sent';
    } else {
        echo 
    'failed';
    }
    now if i change this
    PHP Code:
    $to      'myemail@yahoo.co.uk'
    to
    PHP Code:
    $to      'contact@mydomain.co.uk'
    it works fine.

  2. #2
    SitePoint Evangelist
    Join Date
    Oct 2005
    Location
    Michigan, USA
    Posts
    434
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Could be Yahoo is filtering those emails so you never see them. Maybe your IP is on a blacklist or something. Try a completely different email address if you can. I don't think this is a PHP issue at all. You might be able to have someone check the mail logs on your server just to see if it's getting sent. If so, the problem is elsewhere.
    - Robert

  3. #3
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers Robert for the reply. Tried various other emails I have and no luck. Strange thing is that I can send an email from say outlook or from my phone no problem but just not through my script. This is what led me to believe that the email address wasn't blocked, but I could be wrong. I'll contact my server guys and ask them. It may be a setting that needs ticking. Here's hoping.

  4. #4
    SitePoint Addict
    Join Date
    Mar 2009
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm.... seems I spoke too soon. Now I can't send email from my phone to my yahoo account so I guess it's a blocking issue. Will contact my server guys to ask why


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •