PHP Mail Funtion

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kerepuki
Forum Commoner
Posts: 30
Joined: Fri Oct 29, 2004 12:28 am

PHP Mail Funtion

Post by kerepuki »

Hi,

I am trying to get PHP to send an email but everything I try fails.

I have done the examples and tutorials about the phpmailer() and that didnt work.

I dont want to set up SMTP on my server so could someone please help. Let me know what info I will need to post to get started.

Many thanks!!!
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Re: PHP Mail Funtion

Post by superdezign »

SwiftMailer. Try it.
User avatar
lonelywolf
Forum Commoner
Posts: 28
Joined: Tue Jun 10, 2008 6:15 am

Re: PHP Mail Funtion

Post by lonelywolf »

i started using phpmailer for 3 days ago, i think it quite simple. Maybe you tutorial is not clearly, this is my code for using phpmailer class. First, instance the class, sencond, assign some properties and send. Maybe it'll help you:

Code: Select all

require_once "classes/phpmailer.php";
//send mail to client
$mail = new PHPMailer();
$mail->From = WEBSITEEMAIL;
$mail->FromName = "ABC website";
$contents = "<b>html contents here</b>";
$mail->Subject = 'mail subject' ;
$to = $mailTo ;
$mail->MsgHTML($contents);
$mail->AddAddress($to, $to);
$mail->Send();
kerepuki
Forum Commoner
Posts: 30
Joined: Fri Oct 29, 2004 12:28 am

Re: PHP Mail Funtion

Post by kerepuki »

Thanks for the replies, question, are there any settings I need to change in the phpmailer file? Server setting etc?

I am not new to PHP but I am new to emailing from PHP scripts.

Thanks again!
User avatar
lonelywolf
Forum Commoner
Posts: 28
Joined: Tue Jun 10, 2008 6:15 am

Re: PHP Mail Funtion

Post by lonelywolf »

kerepuki wrote:Thanks for the replies, question, are there any settings I need to change in the phpmailer file? Server setting etc?

I am not new to PHP but I am new to emailing from PHP scripts.

Thanks again!
You don't need to change any settings. After including phpmailer class. Just instance and assign properties. You can simply using mail() function to check whether send mail functions correctly.
Attachments
phpmailer.rar
this is my phpmailer class.
(12.82 KiB) Downloaded 11 times
kerepuki
Forum Commoner
Posts: 30
Joined: Fri Oct 29, 2004 12:28 am

Re: PHP Mail Funtion

Post by kerepuki »

Still not working.

I am running IIS on a windows server 2003 box. Does that help?

Thanks for all the help...appreciate it!
User avatar
lonelywolf
Forum Commoner
Posts: 28
Joined: Tue Jun 10, 2008 6:15 am

Re: PHP Mail Funtion

Post by lonelywolf »

you're running for testing? My server is running linux with apache. If you're running localhost for testing only, i think there is something to install on your system to play with send mail functions.
Post Reply