Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $name = $_POST['name'];
- $email = $_POST['email'];
- $message = $_POST['message'];
- $from = 'From: yoursite.com';
- $to = 'contact@yoursite.com';
- $subject = 'Customer Inquiry';
- $body = "From: $namen E-Mail: $emailn Message:n $message";
- if ($_POST['submit']) {
- if (mail ($to, $subject, $body, $from)) {
- echo '<p>Your message has been sent!</p>';
- } else {
- echo '<p>Something went wrong, go back and try again!</p>';
- }
- }
- ?>
- error_reporting(-1);
- ini_set('display_errors', 'On');
- set_error_handler("var_dump");
- $headers = array("From: from@example.com",
- "Reply-To: replyto@example.com",
- "X-Mailer: PHP/" . PHP_VERSION
- );
- $headers = implode("rn", $headers);
- mail($to, $subject, $message, $headers);
- $headers = array("From from@example.com", // missing colon
- "Reply To: replyto@example.com", // missing hyphen
- "X-Mailer: "PHP"/" . PHP_VERSION // bad quotes
- );
- $to = 'user@example.com';
- // other variables ....
- mail($recipient, $subject, $message, $headers); // $recipient should be $to
- mail('user@example.com', $subject, $message, $headers);
- ini_set("mail.log", "/tmp/mail.log");
- ini_set("mail.add_x_header", TRUE);
- <?php
- $name = $_POST['name'];
- $email = $_POST['email'];
- $message = $_POST['message'];
- $from = 'From: yoursite.com';
- $to = 'contact@yoursite.com';
- $subject = 'Customer Inquiry';
- $body = "From: $namen E-Mail: $emailn Message:n $message";
- $headers .= "MIME-Version: 1.0rn";
- $headers .= "Content-type: text/htmlrn";
- $headers = 'From: from@example.com' . "rn" .
- 'Reply-To: reply@example.com' . "rn" .
- 'X-Mailer: PHP/' . phpversion();
- mail($to, $subject, $message, $headers);
- $header = "From: noreply@example.comrn";
- $header.= "MIME-Version: 1.0rn";
- $header.= "Content-Type: text/html; charset=ISO-8859-1rn";
- $header.= "X-Priority: 1rn";
- mail($to, $subject, $message, $header);
- function send_mail($email, $recipient_name, $message='')
- {
- require("phpmailer/class.phpmailer.php");
- $mail = new PHPMailer();
- $mail->CharSet="utf-8";
- $mail->IsSMTP(); // set mailer to use SMTP
- $mail->Host = "mail.example.com"; // specify main and backup server
- $mail->SMTPAuth = true; // turn on SMTP authentication
- $mail->Username = "myusername"; // SMTP username
- $mail->Password = "p@ssw0rd"; // SMTP password
- $mail->From = "me@walalang.com";
- $mail->FromName = "System-Ad";
- $mail->AddAddress($email, $recipient_name);
- $mail->WordWrap = 50; // set word wrap to 50 characters
- $mail->IsHTML(true); // set email format to HTML (true) or plain text (false)
- $mail->Subject = "This is a Sampleenter code here Email";
- $mail->Body = $message;
- $mail->AltBody = "This is the body in plain text for non-HTML mail clients";
- $mail->AddEmbeddedImage('images/logo.png', 'logo', 'logo.png');
- $mail->addAttachment('files/file.xlsx');
- if(!$mail->Send())
- {
- echo "Message could not be sent. <p>";
- echo "Mailer Error: " . $mail->ErrorInfo;
- exit;
- }
- echo "Message has been sent";
- }
- $headers = "MIME-Version: 1.0" . "rn";
- $headers .= "Content-type: text/html; charset=iso-8859-1" . "rn";
- $headers .= "From: ". $from. "rn";
- $headers .= "Reply-To: ". $from. "rn";
- $headers .= "X-Mailer: PHP/" . phpversion();
- $headers .= "X-Priority: 1" . "rn";
- mail('email@gmail.com', $subject, $message, $headers)
- $config = Array(
- 'protocol' => 'smtp',
- 'smtp_host' => 'mail.domain.com', //your smtp host
- 'smtp_port' => 26, //default port smtp
- 'smtp_user' => 'name@domain.com',
- 'smtp_pass' => 'password',
- 'mailtype' => 'html',
- 'charset' => 'iso-8859-1',
- 'wordwrap' => TRUE
- );
- $message = 'Your msg';
- $this->load->library('email', $config);
- $this->email->from('name@domain.com', 'Title');
- $this->email->to('emaildestination@domain.com');
- $this->email->subject('Header');
- $this->email->message($message);
- if($this->email->send())
- {
- //conditional true
- }
- <?php
- $name = $_POST['name'];
- $email = $_POST['email'];
- $message = $_POST['message'];
- $from = 'From: yoursite.com';
- $to = 'contact@yoursite.com';
- $subject = 'Customer Inquiry';
- $body = "From:" .$name."rn E-Mail:" .$email."rn Message:rn" .$message;
- if (isset($_POST['submit']))
- {
- if (mail ($to, $subject, $body, $from))
- {
- echo '<p>Your message has been sent!</p>';
- }
- else
- {
- echo '<p>Something went wrong, go back and try again!</p>';
- }
- }
- ?>
- $name = $_POST['name'];
- $email = $_POST['email'];
- $reciver = '/* Reciver Email address */';
- if (filter_var($reciver, FILTER_VALIDATE_EMAIL)) {
- $subject = $name;
- // To send HTML mail, the Content-type header must be set.
- $headers = 'MIME-Version: 1.0' . "rn";
- $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
- $headers .= 'From:' . $email. "rn"; // Sender's Email
- //$headers .= 'Cc:' . $email. "rn"; // Carbon copy to Sender
- $template = '<div style="padding:50px; color:white;">Hello ,<br/>'
- . '<br/><br/>'
- . 'Name:' .$name.'<br/>'
- . 'Email:' .$email.'<br/>'
- . '<br/>'
- . '</div>';
- $sendmessage = "<div style="background-color:#7E7E7E; color:white;">" . $template . "</div>";
- // Message lines should not exceed 70 characters (PHP rule), so wrap it.
- $sendmessage = wordwrap($sendmessage, 70);
- // Send mail by PHP Mail Function.
- mail($reciver, $subject, $sendmessage, $headers);
- echo "Your Query has been received, We will contact you soon.";
- } else {
- echo "<span>* invalid email *</span>";
- }
- try this
- <?php
- $to = "somebody@example.com, somebodyelse@example.com";
- $subject = "HTML email";
- $message = "
- <html>
- <head>
- <title>HTML email</title>
- </head>
- <body>
- <p>This email contains HTML Tags!</p>
- <table>
- <tr>
- <th>Firstname</th>
- <th>Lastname</th>
- </tr>
- <tr>
- <td>John</td>
- <td>Doe</td>
- </tr>
- </table>
- </body>
- </html>
- ";
- // Always set content-type when sending HTML email
- $headers = "MIME-Version: 1.0" . "rn";
- $headers .= "Content-type:text/html;charset=UTF-8" . "rn";
- // More headers
- $headers .= 'From: <webmaster@example.com>' . "rn";
- $headers .= 'Cc: myboss@example.com' . "rn";
- mail($to,$subject,$message,$headers);
- ?>
- $myText = (string)$myVar;
- if ($_POST['submit']) {
- $success= mail($to, $subject, $body, $from);
- if($success)
- {
- echo '
- <p>Your message has been sent!</p>
- ';
- } else {
- echo '
- <p>Something went wrong, go back and try again!</p>
- ';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement