For each email sent, "sender" gets a copy.

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
demux
Forum Newbie
Posts: 1
Joined: Mon Feb 09, 2009 1:59 pm

For each email sent, "sender" gets a copy.

Post by demux »

Can anyone see what I'm doing wrong here?

Code: Select all

   $swift =& new Swift(new Swift_Connection_NativeMail()); 
    $sender =& new Swift_Address(utf8_decode("???@???.???"), utf8_decode("???"));
    
    // Sendir tölvupóst:
    $error = 0;
    foreach($arr as $email) {
        $message_html = "<html>\n<head>\n<title>".$_POST['subject']."</title>\n</head>\n<body>\n".stripslashes($_POST['message']);
        $message_html .= '<p style="text-align: right;"><a target="_BLANK" href=http://www.???.???/ay_mailer/unsubscribe.php?email='.$email.'&list='.$plist.'>Afskrá / Unsubscribe</a></p>';
        $message_html .= "\n</body>\n</html>";
        
        $message_plane = my_strip_tags(stripslashes($_POST['message']))."\n\n\n\n".'Afskrá / Unsubscribe'."\n".'(http://www.???.???/ay_mailer/unsubscrib ... '.$plist.')';
        $message_plane = html_entity_decode($message_plane, ENT_NOQUOTES, 'UTF-8');
        
        $message =& new Swift_Message(utf8_decode($_POST['subject']));
        
        $message->headers->setCharset("ISO-8859-1");
        $message->headers->setLanguage("is");
        
        $message->attach(new Swift_Message_Part(utf8_decode($message_plane), "text/plain", '8bit', 'ISO-8859-1'));
        $message->attach(new Swift_Message_Part(utf8_decode($message_html), "text/html", '8bit', 'ISO-8859-1'));
        
        echo 'Sendi á: '.$email;
        
        if(!$swift->send($message, $email, $sender)) {
            echo '<span style="color: red"> -> VILLA!</span>.';
            $error++;
        }
        echo "\n<br />";
    }
 
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: For each email sent, "sender" gets a copy.

Post by Chris Corbyn »

What's the problem you're having?
Post Reply