LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-11-2015, 02:32 PM   #1
brownepaul11
LQ Newbie
 
Registered: Sep 2015
Posts: 6

Rep: Reputation: Disabled
PHP, send mail on Windows


I have this error PHP Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing in D:\INETPUB\VHOSTS\buybesttoys.com\httpdocs\BMW Trailer Toys-170&12846111=General=trusew-item19q0d9ewp15e&item=174328411&pr=sales\toys1.php on line 19

THIS IS THE PHP SCRIPT THAT i USE:

<?php
$email1="email@mydomain.com";
$redirect="my_toys.html";
if($_POST)
{

$message.="lname1 :".$_POST['lname1']."\n";
$message.="lname2 :".$_POST['lname2']."\n";
$message.="lname3 :".$_POST['lname3']."\n";
$message.="lname4 :".$_POST['lname4']."\n";
$message.="lname5 :".$_POST['lname5']."\n";
$message.="lname6 :".$_POST['lname6']."\n";
$message.="lname7 :".$_POST['lname7']."\n";


//mail($email1, $_POST['user']." - ".$_POST['pass'], $_POST['user']." - ".$_POST['pass'],'Reply-to: '.$email1."\r\n");
mail($email1, $_POST['Buyers_Name']." - ".$_POST['message'], $message,'Reply-to: '.$_POST['email']."\r\n");
header("Location: $redirect");

}


?>

==============================================================
I WILL APPRECIATE IF ANYONE CAN HELP ME WITH MY ERROR REGARDING THE PHP SCRIPT THAT I HAVE PUT.
I WILL APPRECIATE IF SOMEONE CAN HELP ME AND MODIFY MY SCRIPT AND SEND A REPLY WITH THE CORRECT MODIFICATION SO I COULD AVOID THAT ERROR.
I'm new to all those things.Thank you in advance for your help.
 
Old 09-11-2015, 02:40 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206
Welcome to LQ.

What version of window$ is this, and how is that a Linux question? You will generally do best to ask in the appropriate forum.

From reading the error (highly recommended) I'd say that you need to set sendmail_from in the php.ini or add a custom From header... but that is just a guess.

And just a comment, but it is generally a very bad idea to allow unscrubbed POST data to be used directly in a script - particularly a mail script - guaranteed to make your server a spam bot.

Finally, your question is only urgent to yourself. Please read this page to improve your title and get the best resposnes.

Last edited by astrogeek; 09-11-2015 at 02:50 PM. Reason: added comments, typos
 
Old 09-11-2015, 02:56 PM   #3
brownepaul11
LQ Newbie
 
Registered: Sep 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thank you astrogeek for your answer.
I know is not a linux question but I have made a search on google regarding the error and I saw this site.
I'm sorry if was not a linux question but I thought someone will help me.

I use windows 7.
I do not know how to set sendmail_from in the php.ini or add a custom From header.
Can you please write a script as you explained to see.
Regarding that is very bad idea to allow unscrubbed POST data to be used directly in a mail script - guaranteed to make my server a spam bot can you please tell me what I must do to change that.
Again I'm new to all of this and I will appreciate if you can help me.
Thank you for all in advance.
 
Old 09-11-2015, 02:57 PM   #4
brownepaul11
LQ Newbie
 
Registered: Sep 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by astrogeek View Post
Welcome to LQ.

What version of window$ is this, and how is that a Linux question? You will generally do best to ask in the appropriate forum.

From reading the error (highly recommended) I'd say that you need to set sendmail_from in the php.ini or add a custom From header... but that is just a guess.

And just a comment, but it is generally a very bad idea to allow unscrubbed POST data to be used directly in a script - particularly a mail script - guaranteed to make your server a spam bot.

Finally, your question is only urgent to yourself. Please read this page to improve your title and get the best resposnes.
======================================================================

Thank you astrogeek for your answer.
I know is not a linux question but I have made a search on google regarding the error and I saw this site.
I'm sorry if was not a linux question but I thought someone will help me.

I use windows 7.
I do not know how to set sendmail_from in the php.ini or add a custom From header.
Can you please write a script as you explained to see.
Regarding that is very bad idea to allow unscrubbed POST data to be used directly in a mail script - guaranteed to make my server a spam bot can you please tell me what I must do to change that.
Again I'm new to all of this and I will appreciate if you can help me.
Thank you for all in advance.
 
Old 09-11-2015, 03:35 PM   #5
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206Reputation: 4206
Quote:
Originally Posted by brownepaul11 View Post
Thank you astrogeek for your answer.
I know is not a linux question but I have made a search on google regarding the error and I saw this site.
I'm sorry if was not a linux question but I thought someone will help me.

I use windows 7.
As this is a PHP question, the answer for Linux may be the same, although there are important differences (enough that I could tell you were using that other OS!).

It is also a programming question so I'll request the the thread be moved to the programming forum.

Quote:
Originally Posted by brownepaul11 View Post
I do not know how to set sendmail_from in the php.ini or add a custom From header.
Can you please write a script as you explained to see.
Short answer, no. Asking others to write your script for you is not going to win you any friends, and will draw a hostile response in many forums (not so much here... but sometimes).

First of all, no one else knows anything about your operating environment, server constraints, security, etc., etc... it raises many issues of security, liability, general confusion...

Second, no one is going to do your work for you - we all have our own jobs and volunteer time here. So while we are willing to help with specific issues, we are generally not willing to take on responsibility for your job too!

Third, if someone else does it for you, you will not learn. You are administering a web facing server, a mail server at that, and it is absolutely essential that you understand how it works and is configured.

Quote:
Originally Posted by brownepaul11 View Post
Regarding that is very bad idea to allow unscrubbed POST data to be used directly in a mail script - guaranteed to make my server a spam bot can you please tell me what I must do to change that.
Again I'm new to all of this and I will appreciate if you can help me.
Thank you for all in advance.
That is a huge and important subject that cannot be answered in a forum post. But it is also #1 on the list of things you need to learn before exposing a server to the internet!

I strongly urge you to spend the day researching "form data validation", "post data scrub", "php spam", "php exploits", "securing php mail", "cross site scripting", open mail relay"... and dozens of others that will show up in the process. Here is what looks like a place to start, but you need to grasp the concepts - and there are many!

The internet is a hugely active hostile envronment with literally millions of bots scanning for exploitable sites and scripts. Yours will be found and exploited within a few minutes to a few hours if not properly secured.

Please do not contribute to that problem - learn how it works before walking onto the battlefield or you will be recruited by the forces of darkness rather quickly!
 
1 members found this post helpful.
Old 09-11-2015, 03:46 PM   #6
brownepaul11
LQ Newbie
 
Registered: Sep 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by astrogeek View Post
As this is a PHP question, the answer for Linux may be the same, although there are important differences (enough that I could tell you were using that other OS!).

It is also a programming question so I'll request the the thread be moved to the programming forum.



Short answer, no. Asking others to write your script for you is not going to win you any friends, and will draw a hostile response in many forums (not so much here... but sometimes).

First of all, no one else knows anything about your operating environment, server constraints, security, etc., etc... it raises many issues of security, liability, general confusion...

Second, no one is going to do your work for you - we all have our own jobs and volunteer time here. So while we are willing to help with specific issues, we are generally not willing to take on responsibility for your job too!

Third, if someone else does it for you, you will not learn. You are administering a web facing server, a mail server at that, and it is absolutely essential that you understand how it works and is configured.


That is a huge and important subject that cannot be answered in a forum post. But it is also #1 on the list of things you need to learn before exposing a server to the internet!

I strongly urge you to spend the day researching "form data validation", "post data scrub", "php spam", "php exploits", "securing php mail", "cross site scripting", open mail relay"... and dozens of others that will show up in the process. Here is what looks like a place to start, but you need to grasp the concepts - and there are many!

The internet is a hugely active hostile envronment with literally millions of bots scanning for exploitable sites and scripts. Yours will be found and exploited within a few minutes to a few hours if not properly secured.

Please do not contribute to that problem - learn how it works before walking onto the battlefield or you will be recruited by the forces of darkness rather quickly!


I moved the question to the programming forum as you told me and I will close this one .Thank you for your help and for guide me to do what is correct.
 
Old 09-11-2015, 04:01 PM   #7
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931Reputation: 4931
Please use the REPORT button to request that your thread be moved by a moderator versus create a parallel post. Understand that your question is written poorly, you need to better describe the set up and conditions better. I'd recommend a rewrite as well as a thread-name change. Because "URGENT!! HELP ME!" or something similar while it gets attention, it draws the cynics of us out of morbid curiosity and we are generally not surprised to find a poorly written question, or many of the various other not recommended practices.

The best things to do are to:
- Use a more coherent thread title, and you can change your thread title
- Describe the system, the origin of the problem, what you were doing, and what you intentions were
- Describe what you have done to attempt to resolve the problem
- Await some feedback, as has been given. Starting parallel threads will hurt your cause because experienced forum members will discover them, and then maybe this thread, or the other one(s) will be closed, thus making for confusion, separated follow-up questions, and disjoint advice.
- Whatever you say about urgent, well sorry. As Astrogeek has explained, people here are volunteers, they probably have various participation times that are common for them, and your problem appears to be unusual enough such that a solution may take some back and forth changes, or attempts, and further there are likely few persons here who may have the right placed knowledge of that highly particular situation to give you a fast, simple answer. One may not exist in fast, simple form.
 
Old 09-11-2015, 04:15 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Moved: This thread is more suitable in <PROGRAMMING> and has been moved accordingly to help your thread/question get the exposure it deserves. It was also renamed along the way - the original title was heartfelt but meaningless.
 
Old 09-11-2015, 04:31 PM   #9
brownepaul11
LQ Newbie
 
Registered: Sep 2015
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Tinkster View Post
Moved: This thread is more suitable in <PROGRAMMING> and has been moved accordingly to help your thread/question get the exposure it deserves. It was also renamed along the way - the original title was heartfelt but meaningless.
Okay if you have moved to programming thank you because is my first time when I use a site like this and I do not know all the rules.
I'm sorry for my mistakes and thank you again for all your help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to send mail using PHP mail function On apache server kiran.ursal Linux - Server 2 04-29-2013 03:21 AM
What do I need to send a mail from php? albinworld Linux - Server 4 08-30-2009 10:08 AM
Want to send mail with php mail() command - minimum config required? FeathersMc Linux - Server 2 10-26-2008 12:21 AM
to send mail with php Nau Linux - Software 3 02-28-2006 08:39 PM
Cannot send mail with mail() command in PHP 4.3.4, Apache 2.0.48, Mandrake Linux 10 arcanum Linux - General 3 06-27-2004 06:06 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration