Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 03:23:29 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155555 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: multiple recipients and mail formating in mailer class  (Read 2028 times)
ruebenwurzel
WebsiteBaker Org e.V.

Offline Offline

Posts: 7973



WWW
« on: May 16, 2008, 06:43:20 PM »

Hello,

got today a mail with some nice ideas for a tweaked mailer class. Here are the descriptions and the changes:

1. multiple recipients
First change is to support multiple recipients on form submission (For example, when a user submits a web request in my case there are usually always two persons responsible - one is the primary responsible and one the secondary when the first is not available. Depending on the particular form it is other people. Creating distribution lists on the mail server is more difficult and I neither have the permissions to do that. So specifying more recpients using comma to separate multiple e-mail addresses is a good help here.

Replace Line 328 of framework/class_wb.php
Code:
$myMail->AddAddress($toaddress);
with:
Code:
$addresses = explode(",", $toaddress);
if (count($addresses) > 0) {
    for ($i = 0; $i < count($addresses); $i++) {
        $add = trim($addresses[$i]);
        $myMail->AddAddress($add);
    }
} else {
    $myMail->AddAddress($toaddress);
}

2.) Email output:
Second change is because of the fact that the form e-mail sent arrives in a one-liner getting wrapped to multiple lines somewhere which makes the e-mail not very readable.

Replace Line 331 of framework/class_wb.php
Code:
$myMail->AltBody = strip_tags($message);
with:
Code:
$myMail->AltBody = str_replace("<br \\>", "\r\n", $message);

So please test it.

Matthias
Logged
diodak

Offline Offline

Posts: 85


« Reply #1 on: May 17, 2008, 07:25:11 AM »

As I understand, i can add several e-mail addresses at form module like in example: test1@tes.com, test2@tes.com, test3@tes.com which in fact I`m doing on some of my websites and this snippet will send 3 mails for several addresses that none of the recepitnents will know about each other?
Logged

Buchsbaum
Lotus

Offline Offline

Posts: 184


« Reply #2 on: May 26, 2008, 09:08:10 AM »

hmm, in WB 2.7 you can have multiple recipients in the settings for form by separating them with a "," but all adresses will show in the recipients mail, as in "TO". (I have tried two adresses).

@ruebenwurzel will this make a recipent "BCC" instead of "TO"?
Logged
DGEC

Offline Offline

Posts: 386


WWW
« Reply #3 on: June 02, 2008, 12:02:57 AM »

I don't think that gets bcc.. seems to be tricky,, try this guy's solution:
http://www.phpbuilder.com/board/showthread.php?t=10314199
Logged
doc
Guest
« Reply #4 on: June 02, 2008, 06:39:46 AM »

@DGEC:
Multiple BCC, CC and TOs is easy to integrate with the PHPMailer class. Have done this for a customer some time ago for the massmail module. If I find the time I will post the solution in the massmail thread.

Regards Christian
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!