PHP: Mail Sending

We will see here the simple mail sending format in PHP,

Before sending mail need to enble and modify the below line PHP.ini file

; For Win32 only.
SMTP=yourservername
smtp_port = 25

; For Win32 only.
sendmail_from = examplemail@domainname.com

the code to send a mail is,

<?php
ini_set(‘SMTP’,’servername’);
mail(“tormail@domainname.com”,”test subject”,”test message”,”From:frommail@domainname.com”);
?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: