944,068 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 690
  • PHP RSS
Nov 9th, 2009
0

PHP email script incomplete for windows and does not send

Expand Post »
Hi Everyone, i am really new at this and slowly getting started, to fast track my website i purchased a web template in flash with a php email script.

I have tried searching the web for a solution but i am not up o scratch with any code that makes sense to me. My problem i was given a very short script in php which functions from within the flash template, i cant change the inner (minimal) workings but i need to add extra code to strip slashes, connect and send through my windows hosting and any other security tips any one can help with.

I hope some one can help as i truly have no idea. I am not sure what i need to do and where to do it, anyway the code is pasted below, hope you can help.

PHP Syntax (Toggle Plain Text)
  1. <?
  2.  
  3. $to = "email@domain.com";
  4. $msg = "$name\n\n";
  5. $msg .= "$message\n\n";
  6.  
  7. mail($to, $msg, "From: My web site\nReply-To: $email\n");
  8.  
  9. ?>
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
thefuzz is offline Offline
2 posts
since Nov 2009
Nov 9th, 2009
0
Re: PHP email script incomplete for windows and does not send
The function you are trying to use works with sendmail, which is a mail server for unix-like systems. In unix/linux/bsd/solaris/uix and so on it is found I believe under /usr/sbin/sendmail.

Unfortunately, in Windows, sendmail does not exist. Therefore, when PHP is looking to find sendmail in Windows, it simply cannot (in your php.ini there are some variables like SMTP, Sendmail_Path etc. As I said before, "sendmail_path" for unix machines =/usr/sbin/sendmail.)

A simple way to go around this, is to use an online SMTP server which you have access on (not gmail or hotmail I'm afraid, has to be some commercial SMTP server I think, one that you pay for), and use the SMTP and port variables to configure that.

If you absolutely need to send email from your windows machine, then you must install an smtp server. There are many good ones out there, I'd recommend Fake Sendmail, which is like the unix sendmail but configured to work under windows.

After you install your mail server, define the path to its executable from your php.ini, as said before under "Sendmail_Path". Also, you will have to do some configuring from the mail server so you enable it to send emails.

Hope this helps!
Reputation Points: 10
Solved Threads: 3
Newbie Poster
violarisgeorge is offline Offline
15 posts
since May 2009
Nov 9th, 2009
0
Re: PHP email script incomplete for windows and does not send
WOW, thanks for the quick reply, thats awesome. Actually i have email and an smtp server with my hosting,
Do you know where i can get script generated given that i have 4 or so fields that need to remain compulsory.

As always help is greatly appreciated.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
thefuzz is offline Offline
2 posts
since Nov 2009
Nov 9th, 2009
0
Re: PHP email script incomplete for windows and does not send
Click to Expand / Collapse  Quote originally posted by thefuzz ...
WOW, thanks for the quick reply, thats awesome. Actually i have email and an smtp server with my hosting,
Do you know where i can get script generated given that i have 4 or so fields that need to remain compulsory.

As always help is greatly appreciated.
The code that you gave should be working fine. You should edit your php.ini settings to include the smtp server of your hosting. There is an SMTP field in php.ini, if it is commented out uncomment it and enter the address of your smtp. Also the port, usually is 25. If the server requires a certificate, then you need to enter your username and password also, but I am not quite sure where you do that.

The easiest way, would be to call up your hosting company and ask them if they can edit your php.ini configuration file so you can send mail with the email account you have with them.
Reputation Points: 10
Solved Threads: 3
Newbie Poster
violarisgeorge is offline Offline
15 posts
since May 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: complex sql database search using php code
Next Thread in PHP Forum Timeline: php inside php not working





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC