HipT Posted February 2, 2010 Share Posted February 2, 2010 Hi all.I'm on Windows 7 x64 and i'm using XAMPP.I'd like to send mail in php using my gmail or my live account.I've tryed a lot of ways but no one works.How can i do this?Thanks. Link to comment Share on other sites More sharing options...
23.12.2012 Posted February 2, 2010 Share Posted February 2, 2010 You need to configure the mail server. Basically, go to C:\xampp\sendmail\sendmail.ini and edit the settings under "A freemail service example" with the proper data, and under "Set a default account", replace "Mercury" with the name of the acount below "A freemail service example". This is an example file. The [user_name] and [password] must be written without square braces. # Example for a user configuration file# Set default values for all following accounts.defaultslogfile "C:\Program Files\xampp\sendmail\sendmail.log"# Mercuryaccount Mercuryhost localhostfrom postmaster@localhostauth off# A freemail service exampleaccount Hotmailtls ontls_certcheck offhost smtp.live.comfrom [user_name]@hotmail.comauth onuser [user_name]@hotmail.compassword [password]# Set a default accountaccount default : Hotmail Link to comment Share on other sites More sharing options...
HipT Posted February 2, 2010 Author Share Posted February 2, 2010 You need to configure the mail server. Basically, go to C:\xampp\sendmail\sendmail.ini and edit the settings under "A freemail service example" with the proper data, and under "Set a default account", replace "Mercury" with the name of the acount below "A freemail service example". This is an example file. The [user_name] and [password] must be written without square braces.Thanks,i've tryed it but it give me this error:PHP Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\Users\Jacopo\Documents\Tesi\Site\Site_014\register.php on line 590 My php.ini mail: [mail function]; For Win32 only.; http://php.net/smtpSMTP = localhost; http://php.net/smtp-portsmtp_port = 25; For Win32 only.; http://php.net/sendmail-fromsendmail_from = mymail@live.it; For Unix only. You may supply arguments as well (default: "sendmail -t -i").; http://php.net/sendmail-pathsendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"; Force the addition of the specified parameters to be passed as extra parameters; to the sendmail binary. These parameters will always replace the value of; the 5th parameter to mail(), even in safe mode.;mail.force_extra_parameters =; Add X-PHP-Originating-Script: that will include uid of the script followed by the filenamemail.add_x_header = Off; Log all mail() calls including the full path of the script, line #, to address and headers;mail.log = "C:\xampp\apache\logs\php_mail.log" I don't know why it gives me this error,i mean,i've remove ';' from the start of the line at "sendmail_from" so it should be ok...Any ideas?Thanks. Link to comment Share on other sites More sharing options...
justsomeguy Posted February 2, 2010 Share Posted February 2, 2010 Did you restart the server after changing the ini file? Link to comment Share on other sites More sharing options...
HipT Posted February 2, 2010 Author Share Posted February 2, 2010 Did you restart the server after changing the ini file?Yes,i've try with refresh button on xampp control and i've also tryed to close and reopen it. Link to comment Share on other sites More sharing options...
23.12.2012 Posted February 2, 2010 Share Posted February 2, 2010 Could you post register.php? Link to comment Share on other sites More sharing options...
HipT Posted February 2, 2010 Author Share Posted February 2, 2010 Could you post register.php?This is the piece of code where i try to send email:$msg = "Thank you for the registration.\n\n<b>Please reconfirm your email by</b><a href=http://localhost:8080 /confirmMailRegistration.php?key=$username&code=MD5($password)>clicking here.</a> \nAlternatively, paste http://localhost:8080/confirmMailRegistration.php?key=$username&code=MD5($password) \n into you're browser address window to confirm that this is your email address.\n In order to reduce spam we require that all email addresses be confirmed before you can login to the site.";if(mail($email,"Confirm your registration.",$msg)) echo("<META HTTP-EQUIV=Refresh Content=0; URL=registrationSuccessful.php>");else echo("<tr><td colspan=2>error.</td></tr>"); Thanks. Link to comment Share on other sites More sharing options...
23.12.2012 Posted February 2, 2010 Share Posted February 2, 2010 Try looking for errors in the sendmail.log file, and commenting the SMTP, smtp_port and sendmail_port in php.ini Link to comment Share on other sites More sharing options...
Synook Posted February 3, 2010 Share Posted February 3, 2010 Try putting quotation marks around the sendmail_from value. Link to comment Share on other sites More sharing options...
HipT Posted February 3, 2010 Author Share Posted February 3, 2010 Try putting quotation marks around the sendmail_from value.If i do it i retrive error that said "invalid ... '"' on line ecc..."Try looking for errors in the sendmail.log file, and commenting the SMTP, smtp_port and sendmail_port in php.iniOk,i've commented these lines,put this:<?phpini_set("sendmail_from","allfreeware@live.it");ini_set("SMTP","smtp.live.com");?> at the beginning of my file and now it say: PHP Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first in C:\Users\Jacopo\Documents\Tesi\Site\Site_015\register.php on line 594 line 594 is if(mail($email,"Confirm your registration.",$msg))Thanks.Ps: the error is the same even if i use phpmailer. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.