Deoctor Posted March 18, 2010 Share Posted March 18, 2010 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.. Quote Link to comment https://forums.phpfreaks.com/topic/195647-unknown-sender-no-subject/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.