PHP Mail Confusion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • samvb
    New Member
    • Oct 2006
    • 228

    PHP Mail Confusion

    Hi guys,
    I am really,really confused about mail servers and their use. I want to send email from my php and someone told to install a mail server. I installed argosoft mail server and it says it has sent the email address and i can see a report in argosoft that it has recieved a message from my server(localhos t). But what i want is to send the email to an external server, say i wanna send email to phpcrazy@yahoo. com. How can i do that? What is the role of mail servers here and which one would you recommend me to use in my site?
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Are you using the php mail() function?

    merry christmas

    Comment

    • samvb
      New Member
      • Oct 2006
      • 228

      #3
      Originally posted by markusn00b
      Are you using the php mail() function?

      merry christmas
      yes. i used mail() function.

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Can you show us the code you're using please?

        Thanks :)

        p.s. i mean the code you use to send the email

        i.e.
        <?php
        mail(...)
        ?>

        Comment

        • realin
          Contributor
          • Feb 2007
          • 254

          #5
          you can simply send a mail without having to install any server on php .. i am using mail() function to send mails from PHP and never installed a server on it.. come on ..

          here is a simple example from php.net

          [PHP]
          <?php
          // The message
          $message = "Line 1\nLine 2\nLine 3";

          // In case any of our lines are larger than 70 characters, we should use wordwrap()
          $message = wordwrap($messa ge, 70);

          // Send
          mail('caffinate d@example.com', 'My Subject', $message);
          ?>
          [/PHP]

          cheers !!

          Comment

          • Markus
            Recognized Expert Expert
            • Jun 2007
            • 6092

            #6
            Originally posted by realin
            you can simply send a mail without having to install any server on php .. i am using mail() function to send mails from PHP and never installed a server on it.. come on ..

            here is a simple example from php.net

            [PHP]
            <?php
            // The message
            $message = "Line 1\nLine 2\nLine 3";

            // In case any of our lines are larger than 70 characters, we should use wordwrap()
            $message = wordwrap($messa ge, 70);

            // Send
            mail('caffinate d@example.com', 'My Subject', $message);
            ?>
            [/PHP]

            cheers !!
            That's what i was going to see if he was using...

            Why would you install a mail server when PHP has one built in?

            - markus.

            Comment

            • samvb
              New Member
              • Oct 2006
              • 228

              #7
              here is the code guys....it is pretty the same thing, but it never sends emails:

              $sendto=$_POST[department];
              $sendto.="@yaho o.com";
              $msg=trim($_POS T[msg]);

              $sender=trim($_ POST[email]);
              $name=trim($_PO ST[name]);
              $msg.="\r\r\r$n ame";
              $sendmsg=@mail( $sendto,'Site Visitor',$msg,' From: $sender');
              if(!$sendmsg) {
              echo "Dearest $name,<br><br>T here was an error sending your email. Please send email to <a href=\"mailto:w ebmaster@anberb eb.com?subject= Error Seding Email\">webmast er</a> to notify us about the accurance of this problem.";
              }
              else {
              echo "Dearest $name,<br><br>T hank you for your email. You will be contacted shortly by an Authorized personel from Anberbeb Share Comapny.<br><br >Greetings,<br> Anberbeb Share Company";
              }
              }

              i expected the installation of a mail server would solve the problem...but no.

              Comment

              • sumeetk
                New Member
                • Dec 2007
                • 6

                #8
                Hi,

                If you are using Windows XP or Windows 2003 you will need to install SMTP service, however if you set you ip address as 127.0.0.1 or localhost, Hotmail,Yahoo and Gmail will reject your email that is sent out from your pc

                You will find your rejected mail in

                C:\Inetpub\mail root\Badmail



                Subject: Delivery Status Notification (Failure)

                This is a MIME-formatted message.
                Portions of this message may be unreadable without a MIME-capable mail program.

                --9B095B5ADSN=_01 C8439CD875BFE20 0000007suv00111
                Content-Type: text/plain; charset=unicode-1-1-utf-7

                This is an automatically generated Delivery Status Notification.

                Delivery to the following recipients failed.

                xxx@hotmail.com




                --9B095B5ADSN=_01 C8439CD875BFE20 0000007suv00111
                Content-Type: message/delivery-status

                Reporting-MTA: dns;xx00111
                Received-From-MTA: dns;suv00111
                Arrival-Date: Fri, 28 Dec 2007 18:50:58 +1200

                Final-Recipient: rfc822;xx@hotma il.com
                Action: failed
                Status: 5.0.0
                Diagnostic-Code: smtp;550 DY-001 Mail rejected by Windows Live Hotmail for policy reasons. We generally do not accept email from dynamic IP's as they are not typically used to deliver unauthenticated SMTP e-mail to an Internet mail server. http://www.spamhaus.or g maintains lists of dynamic and residential IP addresses. If you are not an email/network admin please contact your E-mail/Internet Service Provider for help. Email/network admins, please visit http://postmaster.live .com for email delivery information and support

                Comment

                Working...