Results 1 to 7 of 7

Thread: mail() just send? Can it receives emails?

  1. #1
    Join Date
    Feb 2009
    Posts
    73
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default mail() just send? Can it receives emails?

    Code:
    $to      = 'nobody@example.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: webmaster@example.com' . "\r\n" .
        'Reply-To: webmaster@example.com' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();
    
    mail($to, $subject, $message, $headers);
    this code just can do sending email (SENT items), can anyone give how to make receive emails? (Inbox) ?

    thanks

  2. #2
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    I've never done it so I can't post any answers here, but Google seems to return some good links: http://www.google.com/search?hl=en&q=PHP+receive+emails

    Once you figure it out, let me know what you've done.

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    PHP has a system embedded that allows you to send out emails through a default setup with the server.... it interacts with a mail server. That is to say that it isn't a mail server itself.
    Yes, it only sends messages, and, no, it cannot receive.
    It can, however, get incoming emails if you set it up differently. Google is a good place to start because you can look at several different strategies available.
    But in short you cannot with the default tools setup a complete mail server.
    Depending on your hosting account/server, the options may vary, too.
    The imap functions are also for use with mail, so they might be somewhere to start and are, in many setups, installed by default.

    I hope this gets you started.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Feb 2009
    Posts
    73
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    PHP has a system embedded that allows you to send out emails through a default setup with the server.... it interacts with a mail server. That is to say that it isn't a mail server itself.
    Yes, it only sends messages, and, no, it cannot receive.
    It can, however, get incoming emails if you set it up differently. Google is a good place to start because you can look at several different strategies available.
    But in short you cannot with the default tools setup a complete mail server.
    Depending on your hosting account/server, the options may vary, too.
    The imap functions are also for use with mail, so they might be somewhere to start and are, in many setups, installed by default.

    I hope this gets you started.
    thank you, very nice suggestions

  5. #5
    Join Date
    Aug 2009
    Location
    Orlando Florida USA
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Also, PHPMailer is a class that can be used with and alongside your web hosts email and can greatly enhance your email capabilities. Its open source and is used by a lot of php scripts

  6. #6
    Join Date
    Feb 2009
    Posts
    73
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Bungeebones View Post
    Also, PHPMailer is a class that can be used with and alongside your web hosts email and can greatly enhance your email capabilities. Its open source and is used by a lot of php scripts
    can I Used PHPMailer for receive sms?
    btw, I wanna used my PC as a host for my website only ^^ but It seems not working.

    can I activate STMP for my host? How to do it?

  7. #7
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    I posted some code somewhere on these forums that would receive a messages sent to an email address and the code would check the email and take the message and save the text to a database. As far as the SMTP service on your server, what mail server program are you using? You also have to make sure that you have port 25 unblocked and/or forwarded in your firewall/router. Also, some ISPs block port 25 because of spammers, so this may also be a reason why you can't get it to work.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

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
  •