PHP -Mail problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • roshin123
    New Member
    • Jul 2008
    • 10

    PHP -Mail problem

    Hi ,

    I am using WAMP for my php application.My problem is that I can't send mail using php mail() function . I am not configured SMTP.How can I configure SMTP? which SMTP server can I use for this?

    Thanks & Regards,

    Roshin
  • rohypnol
    New Member
    • Dec 2007
    • 54

    #2
    It should work. You could try to connect to a SMTP server using telnet on port 25 and see at least if you can connect. It may be that your ISP is blocking outgoing connections on port 25 to prevent spamming, you should also contact them to find out. If port 25 is open, please get back to us with an example of how you've called the mail() function.

    Regards,
    Tom

    Comment

    • roshin123
      New Member
      • Jul 2008
      • 10

      #3
      Originally posted by rohypnol
      It should work. You could try to connect to a SMTP server using telnet on port 25 and see at least if you can connect. It may be that your ISP is blocking outgoing connections on port 25 to prevent spamming, you should also contact them to find out. If port 25 is open, please get back to us with an example of how you've called the mail() function.

      Regards,
      Tom
      How can i configure SMTP using GMail? I am using WAMP in my local machine?

      Comment

      • henryrhenryr
        New Member
        • Jun 2007
        • 103

        #4
        try phpmailer:

        http://sourceforge.net/projects/phpmailer

        When you download it, look in the examples and there is one for gmail. It doesn't require any changes to your php setup, just setup the script correctly as in the example...

        Comment

        • roshin123
          New Member
          • Jul 2008
          • 10

          #5
          I have just installed the WAMP in my local machine.Can you give the details of configuring smtp using Gmail in php.ini. should I install phpmailer class?Is there any other way to send mail using smtp?

          Comment

          • henryrhenryr
            New Member
            • Jun 2007
            • 103

            #6
            Originally posted by roshin123
            I have just installed the WAMP in my local machine.Can you give the details of configuring smtp using Gmail in php.ini. should I install phpmailer class?Is there any other way to send mail using smtp?
            I found that phpmailer was the easiest solution. I attempted to setup the SMTP in php and found it wouldn't quite work but I got phpmailer working in about 5 minutes.

            Another method I did try in Windows was to use blat with stunnel and then use exec() to send the blat command to your computer. You can google blat and stunnel - both free software.

            Unless you have a specific reason not to try phpmailer, I really would give it a go - it is just easier...

            Comment

            • roshin123
              New Member
              • Jul 2008
              • 10

              #7
              I used the phpmailer

              But got this error
              Warning: fsockopen() [function.fsocko pen]: unable to connect to ssl://smtp.gmail.com: 465 (Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?) in E:\wamp\www\php mailer\class.sm tp.php on line 122
              Mailer Error: Language string failed to load: connect_host

              Comment

              • henryrhenryr
                New Member
                • Jun 2007
                • 103

                #8
                Originally posted by roshin123
                Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?
                Hi Roshin

                Sorry it wasn't as easy as I suggested! You can fix it, as the error says, by enabling ssl. I didn't realise WAMP doesn't enable by default...

                Quick Instructions:
                open php.ini
                uncomment line ";extension=php _openssl.dll"
                restart WAMP

                Verbose...
                - you should find a link to php.ini if you left click on the WAMP icon in the taskbar
                - look for "config files" click on php.ini.
                - ctrl+f and find "openssl"
                - hopefully the following line is there: ";extension=php _openssl.dll"
                - remove the ";"
                - save php.ini
                - left click on WAMP icon in taskbar again
                - select restart all services
                - test you phpmailer again

                Tested OK on WAMP5 1.7.2

                Hope this works for you!

                Comment

                Working...