Jump to content

Archived

This topic is now archived and is closed to further replies.

romio

add an attachment to mail()

Recommended Posts

This is my mail_sender.php which i use to get some values from a form and send to all subscribers...

[code]
<?php
require_once('config.inc.php');
$query = "select * from subscribers order by id";
mysql_select_db($database, $dbcnx);
$result = mysql_query($query) or die('Error, insert query failed');
$num_rows = mysql_num_rows($result);

if ((isset($_POST["MM_Mailer"])) && ($_POST["MM_Mailer"] == "subscribe"))
{
            
            
            $subject_Form = $_POST['subject'];
            $message_Form = $_POST['message'];
            $email = $_POST['email'];

        while($row = mysql_fetch_array($result))
        {    
            $email = $row['email'];
            $headers .= "Miramare Beach Hotel";
            $headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
            $recipient = $email;
            $subject = $message_Form;
            $message = $message_form;
            $msg = wordwrap( $msg, 1024 );
            mail($recipient, $subject, $message, stripslashes($msg), $headers);
        }
}        
        if(mail($recipient, $subject, $message, stripslashes($msg), $headers))
        {
            echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url='MailIsSend.php'\">";
        }
            else
            {
                echo "The message can not been sent !<br />\n";
            }
?>
[/code]

But i need to add an attachment to my mail how can i do that?

Thanks.

Share this post


Link to post
Share on other sites
attachments are possibly the single most complex thing you can do with PHP mail() function, but after careful study of a tutorial like [a href=\"http://www.hollowearth.co.uk/tech/php/email_attachments.php\" target=\"_blank\"]this one[/a], you should have a pretty good base for getting it done.

Share this post


Link to post
Share on other sites

×

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.