Jump to content

(unknown sender) (no subject)


Deoctor

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 protected][/email]>";
$to = "Chaitu <[email][email protected][/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

Link to comment
https://forums.phpfreaks.com/topic/195647-unknown-sender-no-subject/
Share on other sites

Archived

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

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