Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. PHP mail() configuration

PHP mail() configuration

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
helpquestionphpcomtutorial
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C CodingLover

    Hi all, There are so many articles on the web about 'how to send mails in PHP' using the mail function. But actually it gives lots of errors for me. Have a look at the code segment I tried.

    $to 		= "to@gmail.com";
    $subject 	= "subject goes here";
    $message 	= "message of the email goes here";
    $from 		= "from@gmail.com";
    $headers 	= "From: $from";
    
    mail($to,$subject,$message,$headers);
    echo "Mail Sent ";
    

    When i try the code, gives the following error.

    Warning: mail() [function.mail]: Failed to connect to mailserver at "smtp.emailsrvr.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in F:\WorkOn\PHP\MyPHPSites\emai_test.php on line 10

    How can I workaround with this? Thanks in advance.

    I appreciate your help all the time... CodingLover :)

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #2

    CodingLover wrote:

    How can I workaround with this?

    Check why the server smtp.emailsrvr.com is not accepting your mail request. I just tested it and it hangs after the HELO command, and then drops the connection. You need to contact the site administrator.

    Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

    C 1 Reply Last reply
    0
    • C CodingLover

      Hi all, There are so many articles on the web about 'how to send mails in PHP' using the mail function. But actually it gives lots of errors for me. Have a look at the code segment I tried.

      $to 		= "to@gmail.com";
      $subject 	= "subject goes here";
      $message 	= "message of the email goes here";
      $from 		= "from@gmail.com";
      $headers 	= "From: $from";
      
      mail($to,$subject,$message,$headers);
      echo "Mail Sent ";
      

      When i try the code, gives the following error.

      Warning: mail() [function.mail]: Failed to connect to mailserver at "smtp.emailsrvr.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in F:\WorkOn\PHP\MyPHPSites\emai_test.php on line 10

      How can I workaround with this? Thanks in advance.

      I appreciate your help all the time... CodingLover :)

      M Offline
      M Offline
      Mohibur Rashid
      wrote on last edited by
      #3

      the process you are using is wrong. Please read about how email works. and also follow the link to email using gmail smtp server link[^]

      C 1 Reply Last reply
      0
      • L Lost User

        CodingLover wrote:

        How can I workaround with this?

        Check why the server smtp.emailsrvr.com is not accepting your mail request. I just tested it and it hangs after the HELO command, and then drops the connection. You need to contact the site administrator.

        Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

        C Offline
        C Offline
        CodingLover
        wrote on last edited by
        #4

        No the request accepting. But no luck. I'll check with a different connection if possible, and let you know.

        I appreciate your help all the time... CodingLover :)

        L 1 Reply Last reply
        0
        • M Mohibur Rashid

          the process you are using is wrong. Please read about how email works. and also follow the link to email using gmail smtp server link[^]

          C Offline
          C Offline
          CodingLover
          wrote on last edited by
          #5

          I couldn't find any example in that download bundle. However I tried what that tutorial suggest but it didn't work either.

          Fatal error: Cannot access empty property in ...\phpmailer\phpmailer.inc.php on line 271

          I appreciate your help all the time... CodingLover :)

          M 1 Reply Last reply
          0
          • C CodingLover

            No the request accepting. But no luck. I'll check with a different connection if possible, and let you know.

            I appreciate your help all the time... CodingLover :)

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #6

            CodingLover wrote:

            No the request accepting.

            I'm not sure what you mean by this, but when I tried to connect manually it definitely timed out on the initial HELO command, and then dropped the connection. You need to check with the site what the correct connection protocol is - it may be that you need to use a different port.

            Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

            C J 2 Replies Last reply
            0
            • L Lost User

              CodingLover wrote:

              No the request accepting.

              I'm not sure what you mean by this, but when I tried to connect manually it definitely timed out on the initial HELO command, and then dropped the connection. You need to check with the site what the correct connection protocol is - it may be that you need to use a different port.

              Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

              C Offline
              C Offline
              CodingLover
              wrote on last edited by
              #7

              Yes, when I try to telnet to the port it is not allowed to connect. Seems my settings are invalid or the connection dropped somehow by my network. I'll check and let you know.

              I appreciate your help all the time... CodingLover :)

              L 1 Reply Last reply
              0
              • C CodingLover

                Yes, when I try to telnet to the port it is not allowed to connect. Seems my settings are invalid or the connection dropped somehow by my network. I'll check and let you know.

                I appreciate your help all the time... CodingLover :)

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #8

                Did you telnet to port 25?

                Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                C 1 Reply Last reply
                0
                • C CodingLover

                  I couldn't find any example in that download bundle. However I tried what that tutorial suggest but it didn't work either.

                  Fatal error: Cannot access empty property in ...\phpmailer\phpmailer.inc.php on line 271

                  I appreciate your help all the time... CodingLover :)

                  M Offline
                  M Offline
                  Mohibur Rashid
                  wrote on last edited by
                  #9

                  follow the instruction link

                  1 Reply Last reply
                  0
                  • L Lost User

                    Did you telnet to port 25?

                    Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                    C Offline
                    C Offline
                    CodingLover
                    wrote on last edited by
                    #10

                    Yes I do, but the connection is fail. Seems my network not allowed to connect.

                    I appreciate your help all the time... CodingLover :)

                    1 Reply Last reply
                    0
                    • L Lost User

                      CodingLover wrote:

                      No the request accepting.

                      I'm not sure what you mean by this, but when I tried to connect manually it definitely timed out on the initial HELO command, and then dropped the connection. You need to check with the site what the correct connection protocol is - it may be that you need to use a different port.

                      Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

                      J Offline
                      J Offline
                      jiudingkeji
                      wrote on last edited by
                      #11

                      I think sometimes very troublesome, often mailbox can receive and send http://www.lint-roller.net http://www.u-joint.net http://www.snap-blade.com http://www.auto-control-cable.com http://www.universal-fastener.com http://www.poly-silicon.comt

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups