Jump to content

Archived

This topic is now archived and is closed to further replies.

Deoctor

(unknown sender) (no subject)

Recommended Posts

hai

Using this below code, i have made one application which will send the users with the name as (unknown sender)

and the subject line will the (no subject),

can any one explain me why is this happening??

Seeing this can i think that i can hide my real name and things without authentication using PHP

 

<?php
require_once "Mail.php";

$from = "Support <[email]email@email.com[/email]>";
$to = "Chaitu <[email]myid@gmail.com[/email]>";
$subject = "Hi!";
$body = "<h1>Hi</h1>,\n\nHow are you?";


$host = "mail.example.com";
$username = "smtp_username";
$password = "smtp_password";
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= array ('From' => $from,
  'To' => $to,
  'Subject' => $subject);
$smtp = Mail::factory('smtp',
  array ('host' => $host,
    'auth' => true,
    'username' => $username,
    'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
  echo("<p>" . $mail->getMessage() . "</p>");
} else {
  echo("<p>Message successfully sent!</p>");
}
?>

 

by the way i forgot to tell.

the smtp details i have intentionally removed them from here..  :P

Share this post


Link to post
Share on other sites

×
×
  • 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.