Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 24th, 2004, 10:36 AM
Registered User
 
Join Date: Nov 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to yertanian Send a message via MSN to yertanian
Default mail problem in php

Hi all,
any one tell me if there is something wrong in this code. i have no error, everything in completing, but no e-mail sent..

<?php
$emailfrom='[email protected]';

if($list){
    Header("Location:list.php");
    exit;
}

if(!$file=fopen("newsletter.dat", "r")){
  echo "Could not open the data file";
}else{
  $linesarr=file("newsletter.dat");


  for($i=0; $i<count($linesarr);$i++){
    $tmparr=explode("\n",$linesarr[$i]);
    $linesarr[$i]=$tmparr[0];
$mail_body="Hello $linesarr[$i],

$msg


Thank You,
BIN HANI ESTABLISHMENT
";


  mail($linesarr[$i], 'Bin Hani Est.', $mail_body,"Content-Type:text/html; charset=windows-1256\r\nFrom: $emailfrom\r\nReply-to: $emailfrom");

  }

  echo "</body></html>";
  echo "<html><head><META HTTP-EQUIV=Refresh CONTENT=\"1; URL=sendsuccess.php\">";
  echo "</head><body background=\"images/bgyello.jpg\" bgcolor=#FFFFFF>";
  echo "<table align=center border=0 cellpadding=0 cellspacing=0><tr><td></td></tr></table></body></html>";

}

?>

this file in the action of a form, and the newsletter.dat file exist and contain e-mail addresses.

please help as soon as possible.
 
Old December 1st, 2004, 10:53 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you actually got a mail transfer agent installed and running? Nothing will happen if you haven't ;).
 
Old December 2nd, 2004, 06:45 AM
Authorized User
 
Join Date: Oct 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to SiliconFuRy
Default

Also, have you setup php.ini properly to use an SMTP Server? Or the path to sendmail, depending on OS.

Check the PHP.net docs for that.

http://www.php.net/mail



Many shoes,

Jamez/SiliconFuRy
 
Old December 2nd, 2004, 07:27 AM
Registered User
 
Join Date: Nov 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to yertanian Send a message via MSN to yertanian
Default

ok, its done, it was from the php.ini file.

thnaks a lot for your help

 
Old January 18th, 2005, 10:47 PM
Registered User
 
Join Date: Jan 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to puliko
Default

I am sending html mail with php mail() but somebody get text file not html file in the email show actual html so I don't know what 's going on ?


Puliko
 
Old January 18th, 2005, 10:54 PM
Registered User
 
Join Date: Jan 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to puliko
Default

I used this header to send email

$headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type:text/html; charset=iso-8859-1\r\n";

    $headers .= "From:$Name <$Email]>\r\n";

and use Apache server ,postfix for sending email but somebody get email in text file not html file .Please help me to solve this problem

Puliko





Similar Threads
Thread Thread Starter Forum Replies Last Post
Send mail and attachments with PHP mail function Lofa Beginning PHP 1 June 2nd, 2008 03:24 PM
Problem with sending mail in php Paula222 Beginning PHP 4 July 16th, 2006 03:38 PM
flash php mail xeno Flash (all versions) 1 July 9th, 2005 04:45 PM
PHP mail() problem... mljones Beginning PHP 2 October 6th, 2004 04:49 AM
php mail() problem saicon Beginning PHP 2 August 18th, 2003 12:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.