New to our community ?

Discover a world of possibilities! Join us and explore a vibrant community where ideas flourish and connections thrive.

One of Our Valued Members

Thank you for being part of our community. Your presence enriches our shared experiences. Let's continue this journey together!

Home PHP MAILER Send Mail Without SMTP Authentication

Send Mail Without SMTP Authentication

0

Welcome Back to Shortlearner.com, today we will see how to send mail without SMTP Authentication .

First of all we should know about overall funcationality of SMTP.

Send Mail Without SMTP Authentication

in the basic words we can say SMTP is Simple Mail Transfer Protocol, and it defines the method that handles the process of email exchange and delivery across IPs.
In our Previous Post we send mail with SMTP Authentication.

Also Read : Read XML file Using Php

Track vistior location of your website

Build a Facebook messenger chatbot using php

Generate Random Password Using php

SMTP communication between mail servers uses TCP port 25.
Most of the time we use Phpmailer for sending emails. Initially it was works fine when we using SMTP by username and password.
In the below code we send mail without SMTP Authentication

<?php
 require 'class/class.phpmailer.php';

$mail = new PHPMailer;
$mail->setFrom('xxxx@domainname.com', 'First Last');
$mail->addAddress("xxxx@domainname.com", "Recepient Name");
$mail->addReplyTo("xxxx@domainname.com", "Reply");
$mail->isHTML(true);

$mail->Subject = "Subject Text";
$mail->Body = "<i>Welcome To Shortlearner</i>";
$mail->AltBody = "This is the plain text version of the email content";

if(!$mail->send()) 
{
    echo "Mailer Error: " . $mail->ErrorInfo;
} 
else 
{
    echo "Message has been sent successfully";
}

?>