Need PHP Email Script and Configuration
Posted: Mon Mar 23, 2009 7:49 am
Hello Everyone,
I am new PHP and want to write a script which will send email, so i download many ready to use script from net but all are not working. and giving some cool error which are :
***************************************************
maildemo.php
***************************************************
include("Mail.php");
$mimeBoundary = "boundary_" . md5(uniqid(time()));
$altBoundary = "boundaryAlt_" . md5(uniqid(time()));
$attBoundary = "boundaryAtt_" . md5(uniqid(time()));
$dir = './';
$zipfileName = 'test.zip';
$zipfile = 'test';
$headers = "From: yourmail<mail@yourdomain.com>rn";
$headers .= "MIME-version: 1.0rn";
$headers .= "Content-Type: multipart/mixed; boundary='$mimeBoundary'rn";
$body = "--" . $mimeBoundary . "rn";
$body .= "Content-Type: text/html; charset=iso-8859-1rn";
$body .= "Content-transfer-encoding: 7bitrnrn";
$body .= "<font color='red' face='verdana'>HTML Message</font>rnrn";
$body .= "--" . $mimeBoundary . "rn";
$body .= "Content-Type: application/x-zip-compressed; name=" . $zipfileName . ".gzrn";
$body .= "Content-transfer-encoding: base64rn";
$body .= "Content-Disposition: attachment; filename=" . $zipfileName . ".gzrnrn";
$file = file_get_contents($dir . $zipfile . ".zip");
$file = base64_encode($file);
$file = chunk_split($file);
$body .= $file . "rnrn";
$body .= "--" . $mimeBoundary . "--rn";
mail("patelnehal4u@yahoo.com", "A test zip mail",$body,$headers);
?>
***************************************************
Generated Error
***************************************************
Warning: include(Mail.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\Temp\maildemo.php on line 11
Warning: include() [function.include]: Failed opening 'Mail.php' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\Temp\maildemo.php on line 11
Warning: file_get_contents(./test.zip) [function.file-get-contents]: failed to open stream: No such file or directory in C:\wamp\www\Temp\maildemo.php on line 44
Warning: mail() [function.mail]: Failed to connect to mailserver at "mail.tesco.net" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\Temp\maildemo.php on line 53
***************************************************
is there anything i have to configure in my php.ini or setting up my SMTP server, and if yes how can i do that?
I am new PHP and want to write a script which will send email, so i download many ready to use script from net but all are not working. and giving some cool error which are :
***************************************************
maildemo.php
***************************************************
include("Mail.php");
$mimeBoundary = "boundary_" . md5(uniqid(time()));
$altBoundary = "boundaryAlt_" . md5(uniqid(time()));
$attBoundary = "boundaryAtt_" . md5(uniqid(time()));
$dir = './';
$zipfileName = 'test.zip';
$zipfile = 'test';
$headers = "From: yourmail<mail@yourdomain.com>rn";
$headers .= "MIME-version: 1.0rn";
$headers .= "Content-Type: multipart/mixed; boundary='$mimeBoundary'rn";
$body = "--" . $mimeBoundary . "rn";
$body .= "Content-Type: text/html; charset=iso-8859-1rn";
$body .= "Content-transfer-encoding: 7bitrnrn";
$body .= "<font color='red' face='verdana'>HTML Message</font>rnrn";
$body .= "--" . $mimeBoundary . "rn";
$body .= "Content-Type: application/x-zip-compressed; name=" . $zipfileName . ".gzrn";
$body .= "Content-transfer-encoding: base64rn";
$body .= "Content-Disposition: attachment; filename=" . $zipfileName . ".gzrnrn";
$file = file_get_contents($dir . $zipfile . ".zip");
$file = base64_encode($file);
$file = chunk_split($file);
$body .= $file . "rnrn";
$body .= "--" . $mimeBoundary . "--rn";
mail("patelnehal4u@yahoo.com", "A test zip mail",$body,$headers);
?>
***************************************************
Generated Error
***************************************************
Warning: include(Mail.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\Temp\maildemo.php on line 11
Warning: include() [function.include]: Failed opening 'Mail.php' for inclusion (include_path='.;C:\php5\pear') in C:\wamp\www\Temp\maildemo.php on line 11
Warning: file_get_contents(./test.zip) [function.file-get-contents]: failed to open stream: No such file or directory in C:\wamp\www\Temp\maildemo.php on line 44
Warning: mail() [function.mail]: Failed to connect to mailserver at "mail.tesco.net" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\Temp\maildemo.php on line 53
***************************************************
is there anything i have to configure in my php.ini or setting up my SMTP server, and if yes how can i do that?