#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    24
    Rep Power
    0

    how to set up php.ini to send mail from local machine


    I have php running wonderfully on my local win2000 machine yet don't know what to do in order to send mail using php and calling the mail function.

    My internet provider requires an outgoing mail server username and password which is no problem when using Outlook as there is a proper space to enter it, is this even an issue??? Seems like it would be.

    Here is my php code which works just fine on the remote server: <b>mail($to, $subject, $body, $headers); </b>

    What do I put in my local machine php.ini file and where? Or other tips, thanks so much.
    Last edited by TravPro; December 16th, 2003 at 05:04 PM.
  2. #2
  3. Full Access
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jun 2000
    Location
    London, UK
    Posts
    2,019
    Rep Power
    17
    Change:
    Code:
    [mail function]
    ; For Win32 only.
    SMTP = localhost
    to
    Code:
    [mail function]
    ; For Win32 only.
    SMTP = mail.yourprovider.com
    where mail.yourprovider.com is your ISP's SMTP server.

    Comments on this post

    • valexa agrees
    Alex
    (http://www.alex-greg.com)
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    24
    Rep Power
    0
    I tried using that line but received the following error:

    Warning: mail(): SMTP server response: 553 Invalid address syntax on the line of code which has mail($to, $subject, $body, $headers);

    Not sure why this would happen, doesn't even seem like it's making it to the smtp part. What about the fact that my ISP requires a username and password for sending mail in apps. such as Outlook Express?

    Thanks so much.
  6. #4
  7. Full Access
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jun 2000
    Location
    London, UK
    Posts
    2,019
    Rep Power
    17
    Warning: mail(): SMTP server response: 553 Invalid address syntax on the line of code which has mail($to, $subject, $body, $headers);
    Could you post the rest of the code - i.e. where the variables get defined?
    Not sure why this would happen, doesn't even seem like it's making it to the smtp part.
    It is making it to the SMTP part -- the message "553 Invalid address syntax" comes from your ISP's SMTP server.
    What about the fact that my ISP requires a username and password for sending mail in apps. such as Outlook Express?
    You won't be able to send email through it in this case -- the SMTP server you specify must be configured to relay mail from your server.

    There may be a third-party PHP SMTP class available which does SMTP authentication; have a look on Google.
    Alex
    (http://www.alex-greg.com)
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2005
    Posts
    8
    Rep Power
    0

    Gmail | Outlook


    Hi,

    Along these lines, is there any way to authenticate my gmail username and password (pass them in the mail funtion) so that I can send mail from my gmail account? If not, can I show the Outlook path in my php.ini file so as to use Outlook to send mail through my gmail account. I have set my SMTP and port to match my Outlook settings (which works fine in Outlook for sending/receiving from gmail).

    Like TravPro, I'm running php on a local machine for debugging and would like to explore using php to send mail....

    Thanks for any ideas.
  10. #6
  11. Retired Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2004
    Location
    London, UK
    Posts
    6,669
    Rep Power
    147
    Originally Posted by broncozr
    Along these lines, is there any way to authenticate my gmail username and password (pass them in the mail funtion) so that I can send mail from my gmail account?
    So you want to send mail using the SMTP server smtp.gmail.com? As alexgreg posted above, I don't think there's a way to do this using the mail function since you can't enter your gmail username/password (and it appears that smtp.gmail.com requires authentication). However, there will be scripts around on the internet that support authentication that you can use instead.

    Originally Posted by broncozr
    If not, can I show the Outlook path in my php.ini file so as to use Outlook to send mail through my gmail account.
    You just want to use smtp.gmail.com as your outgoing SMTP server in Outlook? If so, see this link:

    http://mail.google.com/support/bin/a...&ctx=en:search
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2005
    Posts
    8
    Rep Power
    0
    Originally Posted by edwinbrains
    So you want to send mail using the SMTP server smtp.gmail.com? As alexgreg posted above, I don't think there's a way to do this using the mail function since you can't enter your gmail username/password (and it appears that smtp.gmail.com requires authentication). However, there will be scripts around on the internet that support authentication that you can use instead.
    Thanks for the response...

    I don't necessarily have to use gmail. I have an AOL account, but I'm trying to end that! I would use any mail program/site that I could find to just learn something about the mail() function in PHP. I'm running Apache2.0 on WindowsXP (PHP4.3).
    I don't have a "real" website yet, just the free one from Yahoo! So... I'm trying to get some experience on my local machine while I learn PHP. In the end, I would like to be able to establish a large mailing list based on user input, and then I would like to be able to send mass emails for a possible commercial site. I don't know if PHP mail() is amenable to large email-mailings; I have read that other extensions are better at that type of thing.

    Originally Posted by edwinbrains
    You just want to use smtp.gmail.com as your outgoing SMTP server in Outlook? If so, see this link:

    http://mail.google.com/support/bin/a...&ctx=en:search
    I have Outlook set up to use gmail's smtp server, and that's going well. I was kind of poking around in the dark hoping that I could piggyback on my already configured Outlook? Probably not possible?

    Thanks again!
  14. #8
  15. Retired Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2004
    Location
    London, UK
    Posts
    6,669
    Rep Power
    147
    Well the only SMTP servers you seem to have access to require authentication which you can't do using the mail() function. I just did a quick Google search, and I think you want PHPMailer. That way you could use this class to send mail from your computer using the Gmail SMTP servers (entering your Gmail username and password).

    Otherwise you could always setup your own SMTP server so you wouldn't have to use Gmail. If you were using Linux, this would be easy to do (sendmail, for example) but it shouldn't be too hard with Windows. Just try searching Google for "freeware smtp server windows" perhaps.
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2005
    Posts
    8
    Rep Power
    0

    Thanks


    Thanks for the ideas! I'll give them a try....
  18. #10
  19. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2005
    Posts
    2
    Rep Power
    0

    sending mail from localhost


    Originally Posted by alexgreg
    Change:
    Code:
    [mail function]
    ; For Win32 only.
    SMTP = localhost
    to
    Code:
    [mail function]
    ; For Win32 only.
    SMTP = mail.yourprovider.com
    where mail.yourprovider.com is your ISP's SMTP server.


    I just did that.
    The page is opening and the command is successfully executed but there is no result ; i mean the mail is not sent but it shows no error
  20. #11
  21. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2004
    Posts
    3
    Rep Power
    0
    IT WORKED!!!!

    I was having the same problem,

    and I just changed the smtp server instead of localhost
    and now it works!!!!!!!!!!!!








    thank you!!!''

  22. #12
  23. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2011
    Posts
    6
    Rep Power
    0
    how to connect to send mail from my localhost

IMN logo majestic logo threadwatch logo seochat tools logo