Page 1 of 1

PHP.INI FILE CODE NEEDED

Posted: Tue Oct 08, 2013 2:16 pm
by Muzathik
Hi ,
I created the html and php by using sending and email to gmail by using php.ini file but I done everything
fine in html and php file but when i typed the code in php.ini file is not sending email to my gmail account by using html file . could you please give me
urgently anyone solution for this issue.

Html file
-------

Code: Select all

<html>

<body>

<form method="GET" Action="Worty.php">

From:<input type="txt" Name="from" VALUE=jackmountain.com 
SIZE=30><br><br>

TO:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<input type="txt" Name="to" SIZE=30><br>

Cc:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<input type="txt" Name="cc" SIZE=30><br>

Bcc:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<input type="txt" Name="bcc" SIZE=30><br>

Subject:
<input type="txt" Name="subject" SIZE=30>
<br><br>

<TEXTAREA NAME= "mail_body" ROWS="6" COLUMNS="50"></TEXTAREA><br>

<input type="SUBMIT" Name="send" VALUE="send">

</FORM>

</BODY>

</HTML>
PHP FILE
---------------

Code: Select all

<HTML>
<BODY>
<?Php
$mail_to=$_GET['to'];
$mail_from=$_GET['from'];
$mail_cc=$_GET['cc'];
$mail_bcc=$_GET['bcc'];
$mail_header=$mail_from;
$mail_header=$mail_cc;
$mail_header=$mail_bcc;

for ($i=0;$i<count($mail_to);$i++)
{
$mailto=trim($mail_to[$i]);
$mail_subject=$_GET['subject'];
$body=$_GET['mail_body'];
$confirm= mail($mailto,$mail_subject,$body,$mail_header);
if($confirm)
{
echo "To:$mail_to &nbsp;<BR>";
echo "From: $mail_from <BR><BR>";
echo "Cc: $mail_cc &nbsp;<BR>";
echo "Subject: $mail_subject &nbsp;<BR><BR>";
echo $body;
}
else
{
echo "<BR><BR>Mail could not be send !!!.";
}
}
?>
</BODY>
</HTML>
php .ini

Code: Select all

-------------
; For Win32 only.
;sendmail_from = me@example.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path = /usr/sbin/sendmail -t -i

; 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 =

Re: PHP.INI FILE CODE NEEDED

Posted: Tue Oct 08, 2013 8:45 pm
by Christopher
A couple of things:

1. Please don't post entire php.ini files.

2. The correct type for <input> tags is "text" not "txt".

3. You are not validating and filtering you inputs from $_GET

4. You are trying to iterate through the values in $_GET['to'], but it is a string not an array.

Perhaps you should filter and then explode() the value in $_GET['to'].

Re: PHP.INI FILE CODE NEEDED

Posted: Wed Oct 09, 2013 12:59 am
by Muzathik
Brother so no need to use smtp config to sent email to gmail by using php.ini