The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> System Administration
> Mail Server Help
|
how to set up php.ini to send mail from local machine
Discuss how to set up php.ini to send mail from local machine in the Mail Server Help forum on Dev Shed. how to set up php.ini to send mail from local machine Mail Server Help forum discussing tips, tricks, techniques and Spam containment solutions. Topics include mail servers such as Sendmail and Qmail, webmail interfaces such as Squirrelmail and Horde and spam solutions such as SpamAssassin and Bayesian
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

December 16th, 2003, 03:36 PM
|
|
Registered User
|
|
Join Date: Nov 2003
Posts: 24
Time spent in forums: < 1 sec
Reputation 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 04:04 PM.
|

December 17th, 2003, 02:21 PM
|
 |
Full Access
|
|
Join Date: Jun 2000
Location: London, UK
Posts: 2,019
Time spent in forums: 3 sec
Reputation Power: 16
|
|
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.
__________________
Alex
(http://www.alex-greg.com)
|

December 18th, 2003, 09:27 AM
|
|
Registered User
|
|
Join Date: Nov 2003
Posts: 24
Time spent in forums: < 1 sec
Reputation 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.
|

December 20th, 2003, 07:13 PM
|
 |
Full Access
|
|
Join Date: Jun 2000
Location: London, UK
Posts: 2,019
Time spent in forums: 3 sec
Reputation Power: 16
|
|
Quote: |
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?
Quote: |
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.
Quote: | 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.
|

July 6th, 2005, 05:18 PM
|
|
Registered User
|
|
Join Date: Jul 2005
Posts: 8
Time spent in forums: 3 h 3 m 40 sec
Reputation 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.
|

July 7th, 2005, 10:46 AM
|
 |
Retired Moderator
|
|
Join Date: Jan 2004
Location: London, UK
|
|
Quote: | 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.
Quote: | 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/...f&ctx=en:search
|

July 7th, 2005, 09:15 PM
|
|
Registered User
|
|
Join Date: Jul 2005
Posts: 8
Time spent in forums: 3 h 3 m 40 sec
Reputation Power: 0
|
|
Quote: | 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.
Quote: | Originally Posted by edwinbrains |
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!
|

July 8th, 2005, 10:00 AM
|
 |
Retired Moderator
|
|
Join Date: Jan 2004
Location: London, UK
|
|
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.
|

July 8th, 2005, 11:34 AM
|
|
Registered User
|
|
Join Date: Jul 2005
Posts: 8
Time spent in forums: 3 h 3 m 40 sec
Reputation Power: 0
|
|
|
Thanks
Thanks for the ideas! I'll give them a try....
|

August 24th, 2005, 11:17 AM
|
|
Registered User
|
|
Join Date: Aug 2005
Posts: 2
Time spent in forums: 29 m 55 sec
Reputation Power: 0
|
|
|
sending mail from localhost
Quote: | 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
|

September 25th, 2005, 08:30 PM
|
|
Registered User
|
|
Join Date: Jul 2004
Posts: 3
Time spent in forums: 12 m 15 sec
Reputation 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!!!''

|

May 24th, 2011, 04:49 PM
|
|
Registered User
|
|
Join Date: May 2011
Posts: 6
Time spent in forums: 1 h 27 m 54 sec
Reputation Power: 0
|
|
|
how to connect to send mail from my localhost
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|