Page 1 of 1

Mail

Posted: Wed Aug 08, 2007 1:53 am
by rash28
Hi,

How to submit the form to the email id.


Code: Select all

<form name="contactform" method="post" action="" onsubmit="return validate()">
<table width="75%" border="0">
  <tr>
    <td>Name </td>
    <td>
some code here

</table>
<input type="submit" name="submit" value="Submit Query">

Posted: Wed Aug 08, 2007 4:17 am
by volka
please elucidate.

Posted: Wed Aug 08, 2007 5:19 am
by rash28
volka wrote:please elucidate.
I am not able to send mail using mail();

Code: Select all

<?php

$name = "abc";

$invoicetotal = "100";

$mime_boundary = "----Your_Company_Name----".md5(time());

$to = "abc@net.in";
$subject = "This text will display in the email's Subject Field";

$headers = "From: Our Company <28@gmail.com>\n";
$headers .= "Reply-To: Our Company <abc@net.in\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative; boundary="$mime_boundary"\n";

$message = "--$mime_boundary\n";
$message .= "Content-Type: text/plain; charset=UTF-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";

$message .= "$name:\n\n";
$message .= "This email is to confirm that "Our Company" has received your order.\n";
$message .= "Please send payment of $invoicetotal to our company address.\n\n";
$message .= "Thank You.\n\n";

$message .= "--$mime_boundary\n";
$message .= "Content-Type: text/html; charset=UTF-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";
$message .= "<html>\n";
$message .= "<body style="font-family:Verdana, Verdana, Geneva, sans-serif; font-size:14px; color:#666666;">\n";
$message .= "$name:<br>\n";
$message .= "<br>\n";
$message .= "This email is to confirm that "Our Company" has received your order.<br>\n";
$message .= "Please send payment of $invoicetotal to our company address.<br>\n\n";
$message .= "<br>\n";
$message .= "Thank You.<br>\n\n";
$message .= "</body>\n";
$message .= "</html>\n";

$message .= "--$mime_boundary--\n\n";
$mail_sent = @mail( $to, $subject, $message, $headers );
echo $mail_sent ? "Mail sent" : "Mail failed";

?>

I tried this code but the dead.letter is getting saved but not receiving mail to the mail id.

What is the problem please help me with this

Posted: Wed Aug 08, 2007 5:20 am
by volka
no idea, but you might be interested in viewforum.php?f=52

Posted: Wed Aug 08, 2007 7:28 am
by rash28
volka wrote:no idea, but you might be interested in viewforum.php?f=52

Code: Select all

<?php
// The message
$message = "Line 1\nLine 2\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
//Correct email id given
mail(abc@xyz.in', 'My Subject', $message);
?>
In this example the mail is sent and not receiving...
Please tell me what may be the problem

Posted: Wed Aug 08, 2007 7:29 am
by rash28
volka wrote:no idea, but you might be interested in viewforum.php?f=52

Code: Select all

<?php
// The message
$message = "Line 1\nLine 2\nLine 3";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
//Correct email id given
mail(abc@xyz.in', 'My Subject', $message);
?>
In this example the mail is sent and not receiving...
Please tell me what may be the problem.
Is that I need to configure SMTP server.
Sendmail is in /usr/sbin