Jump to content

mail() : correct me where i am wrong??


manu_ghimire

Recommended Posts

hello

i am just getting into php coding !

i want to have one astromatch form and the details filled should be sended to particular email !

i tried but emailing is not working ! means i am not able to recieve email ! where i am wrong ! what should i change please help me regarding this !

here is the code !

 

 

astromatch.php

<?php

if ( !defined( 'SMARTY_DIR' ) ) {

include_once( 'init.php' );

}

 

$cmd = $_POST['cmd'];
if ( $cmd == 'posted' ){

$name = trim($_POST['name']);
$id = trim($_POST['id']);
$email = trim($_POST['email']);
$sex = trim($_POST['sex']);
$dob = trim($_POST['dob']);
$bp = trim($_POST['bp']);
$bt = trim($_POST['bt']);
$pname = trim($_POST['name']);
$pid = trim($_POST['id']);
$pemail = trim($_POST['email']);
$pdob = trim($_POST['dob']);
$pbp = trim($_POST['bp']);
$pbt = trim($_POST['bt']);
$comments = trim($_POST['comments']);

$To      ="manu_ghimire@yahoo.com";

$success= mailSender($To, $name, $id, $email, $sex, $dob, $bp, $bt, $pname, $pid, $pemail, $pdob, $pbp, $pbt,"From: $email");

$t->assign( 'success', $success );
} 

$t->assign('rendered_page', $t->fetch('astromatch.tpl') );

$t->display( 'index.tpl' );
exit;
?>

 

 

astromatch.tpl

 

<form action="" method="post">
<input type="hidden" name="cmd" value="posted"/>
<table border="0" cellspacing="2">
<tr><p align="left"><b> Your Information</b> </p></tr>
<tr><td>Full Name</td><td><input type="text" size="30" name="name"></td></tr>
<tr><td>Grihasta.com Id</td><td><input type="text" size="30" name="id"></td></tr>
<tr><td>Email</td><td><input type="text" size="30" name="email"></td></tr>
<tr><td>Sex</td><td><input type="text" size="30" name="sex"></td></tr>
<tr><td>Date of Birth</td><td><input type="text" size="30" name="dob"></td></tr>
<tr><td>Birth Place</td><td><input type="text" size="30" name="bp"></td></tr>
<tr><td>Birth Time</td><td><input type="text" size="30" name="bt"></td></tr>
<table border="0" cellspacing="2">
<tr>      <tr>

<tr><b> Prospective Partner Information</b></tr>
<tr><td>Full Name</td><td><input type="text" size="30" name="pname"></td></tr>
<tr><td>Grihasta.com Id</td><td><input type="text" size="30" name="pid"></td></tr>
<tr><td>Email</td><td><input type="text" size="30" name="pemail"></td></tr>
<tr><td>Date of Birth</td><td><input type="text" size="30" name="pdob"></td></tr>
<tr><td>Birth Place</td><td><input type="text" size="30" name="pbp"></td></tr>
<tr><td>Birth Time</td><td><input type="text" size="30" name="pbt"></td></tr>
<tr><td valign="top">Comments</td><td><textarea name="comments" rows="6" cols="25"></textarea></td></tr>
<tr><td> </td><td><input type="submit" name="cmd" value="send"><font face="arial" size="1">  <a href=""></a></font></td></tr>
</table>
</form>

 

sir please guide me where i am getting wrong

 

and also one of my question is ! is it so that only 3 fields(email,subject,message,from) can be send ! no other like i done

 

thanx in advance for paying attention !

manughimiye

neps

Link to comment
Share on other sites

thanx for replying , where to look for function mailsender !!

 

i am not so good in coding but just now i am in learning stage

 

what i had done is there was one feedback form !! i edited that and done this

 

now the main problem is i am not reciveing any emails

 

 

what can be the alternative to this code ! can it be more simple but do the same job !

 

 

waiting for your reply

thanx a lot

Link to comment
Share on other sites

<?php

// multiple recipients

$to  = 'aidan@example.com' . ', '; // note the comma

$to .= 'wez@example.com';

 

// subject

$subject = 'Birthday Reminders for August';

 

// message

$message = '

<html>

<head>

  <title>Birthday Reminders for August</title>

</head>

<body>

  <p>Here are the birthdays upcoming in August!</p>

  <table>

    <tr>

      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>

    </tr>

    <tr>

      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>

    </tr>

    <tr>

      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>

    </tr>

  </table>

</body>

</html>

';

 

// To send HTML mail, the Content-type header must be set

$headers  = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

 

// Additional headers

$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";

$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";

$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";

$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";

 

// Mail it

mail($to, $subject, $message, $headers);

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.