Jump to content

Smtp Error


Recommended Posts

Dear Guys,I am facing a problem in sending email whenever i try to send an email from a script an error occurs such as Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\xampp\htdocs\mails.php on line 7Mail Sent. Can anybody guide me please.Infact i cant find a php.ini file in my localserver.There are two files such as php.ini-dist and php.ini-recommended.Should i create a new php.ini file if yes then how?Can i use an id like some1@hotmail.com in SMTP setting.IT will be very appericiated if anybody help me please.i am very new in this field.

Link to post
Share on other sites

Create a new PHP file and run it (open it in a browser):

<?phpphpinfo();?>

That will display a page about PHP, near the top it will tell you the config file that it's actually using. This page lists the locations where PHP looks for the file:http://www.php.net/manual/en/configuration.file.php

Link to post
Share on other sites

Yes i have found php.ini.It opens in notepad.I wrote some text for setting such as:[mail function]; For Win32 only.SMTP = localhostsmtp_port = 25; For Win32 only.;sendmail_from = behonest@hotmail.com; For Unix only. You may supply arguments as well (default: "sendmail -t -i").;sendmail_path = "D:\xampp\sendmail\sendmail.exe -t"But it gives the same problem.Please let me know if i have filled this fields correctly.

Link to post
Share on other sites

It looks fine to me. Keep in mind that if you want it to use a line, remove the ; before the line. It will ignore lines that start with ;, so it's not using your sendmail_from value. Also, obviously this actually needs a mail server in order to work. If you tell it that you have a mail server running on localhost port 25, and you don't, it's going to give an error that it can't connect to the mail server.

Link to post
Share on other sites

Sir,I think i need to install a SMTP server.REcently i am using XAMPP which needs a SMTP server.Because i find a message from "sendmail.ini"like this [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=; smtp port (normally 25)smtp_port=25....................................................Kindly,inform me what steps should i take next to send an email.i am about to install SMTP from internet.U teach me how to activiate it and connect with XAMPP mail server. Thank U!

Link to post
Share on other sites

I never install mail servers on test machines, only on the live versions. The only mail server I've installed is the one that comes with IIS. If you want to install a mail server that's up to you, I can't help with that. Find a mail server you want and follow the instructions to get it installed and configured. If you install it on the same server as the web server and use the default port, then using "localhost" for the host and 25 for the port in php.ini will be fine.When I want to test email stuff, I usually just upload to a server that has an email server running.

Link to post
Share on other sites

DEar Justsomeguy,now i am using ini_set function to send email from local server.i write this line in script " ini_set ("SMTP", "smtp.dslplus.net.pk"); "It return this error. " Parse error: parse error in F:\xampp\htdocs\tube.php on line 8"Can u explain about this error please.

Link to post
Share on other sites

ok thanks.I uploaded my email form in a server and it was fully supported there.I am succeeded to activate an email form.U did a lot of co-operation.FOr this i am really very thankful to u.If i have another problem should i make another forum or mention that issue in this forum.Once again thank u!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...