0

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.

<?
 
   $to = "email@domain.com";
   $msg = "$name\n\n";
   $msg .= "$message\n\n";

  mail($to, $msg, "From: My web site\nReply-To: $email\n");

?>
2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by violarisgeorge
0

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!

0

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.

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.