Jump to content

Script to receive images as attachments


RON_ron

Recommended Posts

What am I doing wrong here? or is it perfect??

 

<?PHP

$to = "mymail@abc.com";

 

$subject = "$subject";

$headers = "From:" .$email."\r\n";

$headers .= "Bcc: $email\r\n";

$message = "Name: " . $thename;

 

$file_array = array(0=>array('file'=>'http://webpath/Kline.jpg',

'mimetype'=>'image/jpeg',

'filename'=>'Kline.jpg'));

 

$sentOk = mail("$to",$subject,$message,$headers);

 

echo $_POST["message"];

echo "sentOk=" . $sentOk;

Link to comment
Share on other sites

Personally I think that mail can be such a finicky thing you should let an API handle it. Personally I use PhpMailer: http://phpmailer.worxware.com/index.php?pg=phpmailer

 

For attachments its quiet simple.

 

<?php

require("class.phpmailer.php");

$mail = new PHPMailer();

$mail->AddAddress("whoever@whatever.com", "John Doe");

$mail->From     = "from@example.com";
$mail->AddAddress("myfriend@example.net");

$mail->Subject  = "First PHPMailer Message";
$mail->Body     = "Hi! \n\n This is my first e-mail sent through PHPMailer.";

$mail->AddAttachment("images/phpmailer.gif");

if(!$mail->Send()) {
    echo 'Message was not sent.';
    echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent.';
}

?>

Link to comment
Share on other sites

My submit form is in FLASH. I'm using this PHP to catch the data + the images (as attachments) in to my mail. Data capturing works pretty well. So I tried adding only the line AddAttachemnt. But there's some error in it.  :confused: What's wrong here? I need the images tobe as attachemnts.

 

Current code

<?PHP

$to = "mamail@mail.com";

 

$subject = "subject";

$headers = "From:" .$email."\r\n";

$headers .= "Bcc: $email\r\n";

AddAttachment("images/Kline.jpg");

$message = "Name: " . $thename; 

 

echo "sentOk=" . $sentOk;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.