Actually, I am learning php and I am eager to know how to send mails from php? Can you give me any start links from where i can learn to send mails and implement on my PC?I have learnt php on my own and now i want to implement this on my website. please help!!

thanks in advace.
Any help will be appreciated.

Recommended Answers

All 7 Replies

**Example:Send Mail using PHP **

$message1="<table cellpadding=2 cellspacing=0><tr valign='top' >Test</tr></table>";
$semi_rand = md5(time());

$email_from ="test@test.in"; // Who the email is from
$email_subject = "Test"; // The Subject of the email
$email_message = $message1;
$email_to =" tset@test.in"; // Who the email is to
$headers = "From: ".$email_from. "\r\n";
$headers .= "Content-type: text/html\r\n"; 
$ok = mail($email_to, $email_subject, $email_message, $headers);

Beware of the simple mail() function.

You should set up a nice SMTP send function. Sometimes LINUX servers dont send out emails to other servers to the domain that they are in.

Beware of the simple mail() function.

You should set up a nice SMTP send function. Sometimes LINUX servers dont send out emails to other servers to the domain that they are in.

That's correct! You can look at http://formtoemail.com/FormToEmail.txt if you don't want to go through setting up smtp servers. It works right out of the box.

hey! @Summernight. acutually, i want to learn how to send the mail. I don't want just to implement it somehow. Please give me link for TUTORIALS of php so that i can make or implement php script after learning through them.
thanks.

@szabiza can u please tell me the setting in php.ini so that i can configure and run my e-mail script succesfully. am not getting setting of php.ini anywhere. HELP please as ASAP.

The mail() function is really only useful for sending plain text. Someone mentioned SMTP. If you want to do that, you are going to need a library like:

http://barebonescms.com/documentation/ultimate_email_toolkit/

I've found that sending via SMTP instead of sendmail more reliably gets through spam filters. Also, I've found that as soon as I start doing anything fancy like attachments or HTML, the code suddenly gets complicated. Best to use a library for e-mail in PHP. The above has several working examples and the author will help you out if you get too stuck.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.