24, July 2008

New release :: Attachment Mailer class - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Miscellaneous scripts or snippets (Moderator: Olaf)
Topic: New release :: Attachment Mailer class
« previous next »
Pages: [1] Print

Author Topic: New release :: Attachment Mailer class  (Read 1297 times)
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6280
38506 credits
Members referred : 374


It's time to use PHP5!


« on: Nov 13, 2006, 10:38:31 PM »

date: 2006-11-13
version: 1.20
RN: Since this version the class is changed into a full featured html mailer class incl. html mail + (inline) attachments, alternative text format, inline attachments mixed with external attachments and much more. Most methods are changed and the structure how an objects is defined is updated, too. You need to update formerly mail scripts, check the updated documentation.
« Last Edit: Nov 13, 2006, 10:45:37 PM by olaf »


Last blog : 4th of July Lottery from TemplateMonster.com
Just another rainy day
*
Posts: 1
6 credits
Members referred : 0


« Reply #1 on: Sep 15, 2007, 05:29:19 PM »

This is a solution for small bug (I think) in version 1.2.
My antispam service seems to mark emails sent with AMc always as "spam" because the missing empty line after the end of headers.

The solution is to change, around line 226

Code:
$this->headers .= "This is a multi-part message in MIME format.".LIBR;

with

Code:
$this->headers .= "This is a multi-part message in MIME format.".LIBR.LIBR;

quick and dirty Smiley

To avoid overhead of CPU if you need to send multiple emails with attachments, change class as follow:

add in the "class var" section

Code:
var $body_message='';



and change in function process_mail
       
Quote
      $body_message=$this->build_message();
      if (mail($this->mail_to, $this->mail_subject,$body_message , $this->headers, "-f".$this->webmaster_email)) {


in

Code:
if ($this->body_message==''){
$this->body_message=$this->build_message();
}
if (mail($this->mail_to, $this->mail_subject,$this->body_message , $this->headers, "-f".$this->webmaster_email)) {


finally add this new method

Code:
function ForceChangeDestinationTo($new_email_address){
if($this->check_mail_address($new_email_address)){
$this->mail_to=$new_email_address;
}
}


and now you can send multiple emails as follows:
Code:
$test = new attach_mailer($name = "Me", $from = "me@mydomain.com", $to = "you1@domain1.com", $cc = "", $bcc = "", $subject = "Best regards");
$test->text_body = "...Some body text\n\n the admin";
$test->add_attach_file("image.gif");
$test->add_attach_file("ip2nation.zip");
$test->process_mail();

if ($test->ForceChangeDestinationTo("name2@domain2.com")){ $test->process_mail(); }
if ($test->ForceChangeDestinationTo("name3@domain3.com")){ $test->process_mail(); }
if ($test->ForceChangeDestinationTo("name4@domain4.com")){ $test->process_mail(); }


I'm working on major improvements.... thanks Olaf for your great work!
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=4784
Tags : html email Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Miscellaneous scripts or snippets (Moderator: Olaf)
Topic: New release :: Attachment Mailer class
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Jul 24, 2008, 11:49:45 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 35.717
Total Topics: 7.379
Total Members: 3.711
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: Asimina

30 Guests, 5 Users online :

11 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.