the mail function - problem

Problems with the Windows version of XAMPP, questions, comments, and anything related.

the mail function - problem

Postby rctrimble » 29. January 2009 06:30

I am having troubles with the mail function on my local computer install. i had it working but somehow after fiddling with mercury mail it stopped working. before fiddling with that i had it working by having set the following in the apache/bin/php.ini file

[mail function]
; For Win32 only.
SMTP = smtp.comcast.net
smtp_port = 25
username = zerre
password = compar3

; For Win32 only.
sendmail_from = zerre@comcast.net


those are the only configurations i unfourtunatly remember doing. after fiddling with mercury mail and mail function no longer working i uninstalled xampp and reinstalled. ive been having no luck setting mail function to use mail.comcast.net with my username and password etc as shown above.

so i have uninstalled and reinstalled again. everything is at default settings, only thing ive done is log into xammp directory clicked english then went to security and set password for mysql and xampp. anyone know what the next step is? or, i mean, remember what it is i have to do off hand to get my mail function to use my smtp.comcast.net account


thanks for your help

this is the error i get:
Warning: mail() [function.mail]: Failed to connect to mailserver at "smtp.comcast.net" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\MAIL\mail.php on line 25
rctrimble
 
Posts: 5
Joined: 29. January 2009 06:18

Re: the mail function - problem

Postby Izzy » 29. January 2009 07:20

rctrimble wrote:[mail function]
; For Win32 only.
SMTP = smtp.comcast.net
smtp_port = 25
username = here
password = here

; For Win32 only.
sendmail_from = zerre@comcast.net
There is no place to add or use your login credentials within this php.ini file.
They would need to be removed
Code: Select all
[mail function]
; For Win32 only.
SMTP = smtp.comcast.net
smtp_port = 25

; For Win32 only.
sendmail_from = zerre@comcast.net
Your login credentials would be entered in your script.

Or you would use the fake sendmail alternative by commenting out the above and uncommenting this sendmail line below it even though it says for Unix only - use one or the other

Code: Select all
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"

Then in your script you would refer your mail setting to use sendmail where you can enter your mail login credentials - xampp\sendmail\sendmail.ini file.

Save the php.ini and/or sendmail.ini file and restart Apache then test your script again.

Please post back if the above helped solve you problem.
Thanks.
Last edited by Izzy on 29. January 2009 08:09, edited 1 time in total.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: the mail function - problem

Postby Izzy » 29. January 2009 08:07

BTW never post a real username or password in a forum it spells danger.
So edit your first post and remove them if they are your real ones - it may already be too late as Google spiders the Forum very often and then your user/pass is all over the Internet.
You may have to change them at comcast.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: the mail function - problem

Postby rctrimble » 29. January 2009 20:35

thank you for your help. its not my real username, i just didnt want my email to look like a default, looks pretty real though. might as well leave it just to spam their spam


ok i removed username and password from php.ini
so if i dont use the sendmail.ini way (uncommenting sendmail_path = "C:\xampp\sendmail\sendmail.exe -t") then what do i add to the below script to send an email to include my username and password


<?php
mail("zerre@comcast.net","this is subject","this is message");
?>

should that do it? is there anything to the default xampp installation needed to be uncommented etc for it to work?


if i go the sendmail.ini way and comment out this information, like so

[mail function]
; For Win32 only.
;SMTP = smtp.comcast.net
;smtp_port = 25


and edit the xampp\sendmail\sendmail.ini file, do you know what i should change?
below is the sendmail.ini as i have it currently
i am sending to a Comcast email account if you have familiarity with setting this type of email it would probaly make things clearer

thank you for your help


Code: Select all
; configuration for fake sendmail

; if this file doesn't exist, sendmail.exe will look for the settings in
; the registry, under HKLM\Software\Sendmail

[sendmail]

; you must change mail.mydomain.com to your smtp server,
; or to IIS's "pickup" directory.  (generally C:\Inetpub\mailroot\Pickup)
; emails delivered via IIS's pickup directory cause sendmail to
; run quicker, but you won't get error messages back to the calling
; application.

smtp_server=localhost

; smtp port (normally 25)

smtp_port=25

; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn't provided
; if you want to override the value in the registry, uncomment and modify

;default_domain=local

; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging

;error_logfile=error.log

; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging

;debug_logfile=debug.log

; if your smtp server requires authentication, modify the following two lines

;auth_username=
;auth_password=

; if your smtp server uses pop3 before smtp authentication, modify the
; following three lines

;pop3_server=mail.comcast.net
;pop3_username=
;pop3_password=

; to force the sender to always be the following email address, uncomment and
; populate with a valid email address.  this will only affect the "MAIL FROM"
; command, it won't modify the "From: " header of the message content

;force_sender=me@localhost

; sendmail will use your hostname and your default_domain in the ehlo/helo
; smtp greeting.  you can manually set the ehlo/helo name if required

;hostname=localhost
rctrimble
 
Posts: 5
Joined: 29. January 2009 06:18

Re: the mail function - problem

Postby Izzy » 29. January 2009 23:29

rctrimble wrote:ok i removed username and password from php.ini
so if i dont use the sendmail.ini way (uncommenting sendmail_path = "C:\xampp\sendmail\sendmail.exe -t") then what do i add to the below script to send an email to include my username and password


<?php
mail("zerre@comcast.net","this is subject","this is message");
?>
There is no place for a user/pass in the mail function:
http://us.php.net/manual/en/function.mail.php

If you had a script with a configuration section like in phpBB and some CMS scripts for example, then they usually have a section to add your e-mail details including user/pass.

In your case I would use the fake sendmail as included below but adjust the settings with your own details.
rctrimble wrote:if i go the sendmail.ini way and comment out this information, like so

[mail function]
; For Win32 only.
;SMTP = smtp.comcast.net
;smtp_port = 25

and edit the xampp\sendmail\sendmail.ini file, do you know what i should change?

Code: Select all
[mail function]
; For Win32 only.
;SMTP = smtp.comcast.net
;smtp_port = 25

; For Win32 only.
sendmail_from = zerre@comcast.net
; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"

Code: Select all
; configuration for fake sendmail

; if this file doesn't exist, sendmail.exe will look for the settings in
; the registry, under HKLM\Software\Sendmail

[sendmail]

; you must change mail.mydomain.com to your smtp server,
; or to IIS's "pickup" directory.  (generally C:\Inetpub\mailroot\Pickup)
; emails delivered via IIS's pickup directory cause sendmail to
; run quicker, but you won't get error messages back to the calling
; application.

smtp_server=mail.comcast.com

; smtp port (normally 25)

smtp_port=25

; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn't provided
; if you want to override the value in the registry, uncomment and modify

;default_domain=local

; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging

;error_logfile=error.log

; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging

debug_logfile=debug.log

; if your smtp server requires authentication, modify the following two lines

auth_username=comcast mail username
auth_password=comcast mail password

; if your smtp server uses pop3 before smtp authentication, modify the
; following three lines

;pop3_server=mail.comcast.net
;pop3_username=
;pop3_password=

; to force the sender to always be the following email address, uncomment and
; populate with a valid email address.  this will only affect the "MAIL FROM"
; command, it won't modify the "From: " header of the message content

force_sender=zerre@comcast.net

; sendmail will use your hostname and your default_domain in the ehlo/helo
; smtp greeting.  you can manually set the ehlo/helo name if required

;hostname=localhost
Note the debug.log file location and change it if required and read it if you get errors.

Most of the sendmail.ini file is well commented with what is required in the settings.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: the mail function - problem

Postby rctrimble » 30. January 2009 01:13

thank you Izzy for your help. i have fixed (solved) my problem now. thank you for your help, my internet connection was down on my server and i have gone the route not using the sendmail way so i reaplied the settings i had before uninstalling xampp and leaving out the username and password

its funny that i can send email now with <?php mail("email@email.com","subject","message");?>

no where do i specify my smtp username and password

this is all i have configured. php.ini

SMTP = smtp.comcast.net
smtp_port = 25

; For Win32 only.
sendmail_from = zerre@comcast.net


how is it possible it is working without me specifying username and password, is this normal? or do i have some program outside of xampp helping, or something.
Last edited by rctrimble on 30. January 2009 01:28, edited 1 time in total.
rctrimble
 
Posts: 5
Joined: 29. January 2009 06:18

Re: the mail function - problem

Postby Izzy » 30. January 2009 01:22

Thanks for posting back with the details and if it works for you then all is well that ends well.

Good luck.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: the mail function - problem

Postby rctrimble » 30. January 2009 01:29

thats funny i was editing my post when you reapplied i update the post two up, thanks for your help. im trying to understand why i can send mail without specifying my smtp username and password anywhere at all, is that possible? its working somehow
rctrimble
 
Posts: 5
Joined: 29. January 2009 06:18

Re: the mail function - problem

Postby Izzy » 30. January 2009 01:39

I know nothing of comcast or the way it accepts SMTP email through it's servers or whether or not it requires SMTP authentication - perhaps all they require for SMTP is the senders email address.

To find out ask comcast as unless you specify the authentication credentials then they are not and can't be entered by anything in XAMPP.

I would assume that they require authentication to receive email via pop and some require pop before smtp, so if you have just, or within their configured time frame, popped your email then that may be the reason comcast are accepting SMTP without authentication - you can test this out by not popping your email for perhaps an hour or two then try sending mail from your script again, but I have no idea what the time frame would be on comcast, often it is a little as 30 minutes before you have to again re-enter you mail credentials for SMTP.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: the mail function - problem

Postby rctrimble » 30. January 2009 01:54

i will try that time delay, hm, that's interesting
thanks
rctrimble
 
Posts: 5
Joined: 29. January 2009 06:18

Re: the mail function - problem

Postby Izzy » 30. January 2009 02:03

These Google search results may hold some clues to pop-before-smtp at comcast.

From what I have read already it may be that because you are connected with a comcast cable network that your email credentials are being entered automagically perhaps by your network configuration, but only a guess as I do not know what network conf details comcast use.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 96 guests