Mail

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rash28
Forum Commoner
Posts: 38
Joined: Wed Aug 01, 2007 1:21 am

Mail

Post 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">
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

please elucidate.
rash28
Forum Commoner
Posts: 38
Joined: Wed Aug 01, 2007 1:21 am

Post 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
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

no idea, but you might be interested in viewforum.php?f=52
rash28
Forum Commoner
Posts: 38
Joined: Wed Aug 01, 2007 1:21 am

Post 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
rash28
Forum Commoner
Posts: 38
Joined: Wed Aug 01, 2007 1:21 am

Post 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
Post Reply