sending mail problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have a script that sends a mail with attachment the only problem i have is
that when the mail is sent the reciver don't see the from: mail i have

I also tryed to put this peace of code
$fromWho ='From:' . "\r\n" .

'Reply-To:' . "\r\n" .

'X-Mailer: PHP/' . phpversion();

Like the times before when i used the standard mail() function and it worked

This is a part of code from my script (the comments and some variable names
are in Croatian and yes it is for a sex site (not mine :-)):

function provjeraLozinke($odabir,$lozinka,$popis){

GLOBAL $eMailAdresa,

#ovdje treba sredit funkciju za odabir fajla za sada je samo jedan if


if ($odabir == 'penis'){



// array with filenames to be sent as attachment

$files = array($imeFajla);

// email fields: to, from, subject, and so on

$to = $eMailAdresa;

$from = "druzenje";

$subject ="Dostava zatraženog fajla";

$message = "Ovim mailom vam je dostavljen fajl";

$headers = "From: $from";

// boundary

$semi_rand = md5(time());

$mime_boundary = "==Multipart_Boundary_xx";

// headers for attachment

$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . "

// multipart boundary

$message = "This is a multi-part message in MIME format.\n\n" .
"--\n" . "Content-Type: text/plain;
charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message
. "\n\n";

$message .= "--\n";

// preparing attachments


$file = fopen($files[$x],"rb");

$data = fread($file,filesize($files[$x]));


$data = chunk_split(base64_encode($data));

$message .= "Content-Type: ;\n" . "
name=\"$files[$x]\"\n" .

"Content-Disposition: attachment;\n" . " filename=\"$files[$x]\"\n" .

"Content-Transfer-Encoding: base64\n\n" . $data . "\n\n";

$message .= "--\n";


// k

if ($popis[$odabir]==$lozinka){

if(@mail($to, $subject, $message, $headers)){

echo $documentTemplateFirst.$allRight.$documentTemplateSecond;



echo $documentTemplateFirst.'<h2 style="text-align:center">nešto nije u redu
sa procesom, molim probajte opet</h2>'.$documentTemplateSecond;


#ubaciti za slanje maila funkciju na korisnikov mail i na mail vlasnika

#ispis stranice da je sve u redu i poslano



echo $documentTemplateFirst.$wrongPassword.$documentTemplateSecond;



if(filter_var($eMailAdresa, FILTER_VALIDATE_EMAIL)) {



else {

echo $documentTemplateFirst.$wrongEmailAddress.$documentTemplateSecond;


Re: sending mail problem

alejandro wrote:
Quoted text here. Click to load it
Quoted text here. Click to load it

What do they see?  What does the email header look like?  Is it correct?

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: sending mail problem

alejandro wrote:
Quoted text here. Click to load it
Something changed in PHP's mail function that broke a lot of my code.

This is what I use now


Note: \r\n no longer seems to work.
Note: use of -f to set the sender envelope address.

Site Timeline