Jump to content


Photo

[solved]email help cheers learning.


  • Please log in to reply
7 replies to this topic

#1 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 09 August 2006 - 02:21 AM

I have been learning to send email to my self but with a attachment i see the attachment but not the message.

dont make sence please help cheers.

<?php
$to="me@me.com";
$subject="My news added text file to read";
$message ="hi there i am redarrow";
$headers ="content-disposition: attachment: filename=john.txt\r\n ";
$headers.="content-type: plain/text: ";
if(!$send=mail($to,$subject,$message,$headers)){
echo "email not sent";
}else{
echo "email sent!";
}
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#2 SephirGaine

SephirGaine
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 09 August 2006 - 02:27 AM

Although I can't exactly pinpoint where you went wrong, I can give you what I'm using for an email form-submittal. Hopefully you can take a look as maybe find out where your code might be off? Might be a little bit messy, but I tried to keep it as clean and simple as possible.

<?php
$EmailFrom = "myemail";
$EmailTo = "myemail";
$Subject = "Contact Form Submittal";
$Name = Trim(stripslashes($_POST['Name'])); 
$Company = Trim(stripslashes($_POST['Company'])); 
$Email = Trim(stripslashes($_POST['Email'])); 
$Telephone = Trim(stripslashes($_POST['Telephone'])); 
$Message = Trim(stripslashes($_POST['Message'])); 

$validationOK=true;
if (Trim($Telephone)=="") $validationOK=false;
if (!is_numeric($Telephone)) $validationOK=false;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Company: ";
$Body .= $Company;
$Body .= "\n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "\n";
$Body .= "Telephone: ";
$Body .= $Telephone;
$Body .= "\n";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "\n";

$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=success.html\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?>


#3 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 09 August 2006 - 02:30 AM

I am not sure, but for the headers can't you just do:

<?php
$to="me@me.com";
$subject="My news added text file to read";
$message ="hi there i am redarrow";
$headers .="content-disposition: attachment: filename=john.txt\r\n ".
"content-type: plain/text: ";
if(!$send=mail($to,$subject,$message,$headers)){
echo "email not sent";
}else{
echo "email sent!";
}
?>
?

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 09 August 2006 - 02:37 AM

what i got so far but no message and yes cheers for your code but i am learning ok mate but thank you.

<?php

$to=$_POST['to'];
$subject=$_POST['subject'];
$message=$_POST['message'];
$headers=$_POST['headers'];

$to="me@me.com";
$subject="My news added text file to read";
$message ="hi there i am redarrow";
$headers ="content-disposition: attachment: filename=john.txt\r\n "."content-type: plain/text: ";
if(!$send=mail($to,$subject,$message,$headers)){
echo "email not sent";
}else{
echo "email sent!";
}
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 09 August 2006 - 02:42 AM

Try:

<?php

$to=$_POST['to'];
$subject=$_POST['subject'];
$message=$_POST['message'];
$headers=$_POST['headers'];

$to="email@email.com";
$subject="My news added text file to read";
$message ="hi there i am redarrow";
$headers ="content-disposition: attachment: filename=john.txt\r\n "."content-type: plain/text: ";
if(mail($to,$subject,$message,$headers)){
echo "email not sent";
}else{
echo "email sent!";
}
?>


#6 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 09 August 2006 - 02:50 AM

tell you what this is a code that lets you send the message then writes the $message varable contents in the file weried init.

please delete my email cheers.

<?php

$to=$_POST['to'];
$subject=$_POST['subject'];
$message=$_POST['message'];
$headers=$_POST['headers'];

$to="me@me.com";
$subject="My news added text file to read";
$message ="hi there i am redarrow";
$headers ="content-disposition: attachment: filename=john.txt\r\n "."content-type: plain/text: ";
if(!$send=mail($to,$subject,$message,$headers)){
echo "email not sent";
}else{
echo "email sent!";
}
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#7 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 09 August 2006 - 03:23 AM

thanks for all help i am not doing nothink wrong i have read lots know and theres a rule that if you try to send messages and attachments with php your heading for a headake and just use a url to put the attachment within.

so the way i wanted to setup is not pratical unless you no how to but i dont so for example .

these two emil example are correct.

<?php
 //send a email normally.

if you nedd to add a pic text file ect ect use a url in the message varable.

$to="me@me.com";
$subject="my news";
$message="hi there i am redarrow";
$headers="bbc:admin@freesinflesmail.ath.cx";
if(!$send=mail($to,$subject,$message,$headers)){

echo "Mail Problam";

}else{

echo "Mail Sent";

}



//send a attachment file.



$to="me@me.com";
$subject="My news added text file to read";
$message="john.txt";
$a=file_get_contents($file);
$headers="content-disposition: attachment: filename=john.txt\r\n ";
if(!$send=mail($to,$subject,$message,$headers)){
echo "email not sent";
}else{
echo "email sent!";
}



admin can you kindly delete my proper email address in the post from other user thank you.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#8 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 09 August 2006 - 10:37 AM

Just found this article, http://www.theukwebd...attachments.php . I think that will help you with what you want.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users