Jump to content

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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