22, November 2008

Attachment mail 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: Attachment mail class
« previous next »
Pages: [1] Print

Author Topic: Attachment mail class  (Read 777 times)
I crack Photoshop!
*
Posts: 3
22 credits
Members referred : 0


« on: Aug 06, 2007, 02:50:42 AM »

Hi,
A very nice class you guy`s/girls created with some nice examples, i got it up and running within seconds.
i have one question, hoe can i get variables in the mail?
I explain:

I use a form on my website that people fill in. Name address etc.
when they submit a mail is send to them and also to me, both with attachments.
The data that the user provided in the form is gone then, so i only have their emailaddress.
If this is possible to add one way or the other would you be so kind to explain how and if possible provide in your answer a small example.
I use the HTM version so my guess is that i have to add something here:
Code:
$test->add_html_image("image.gif");
$test->add_html_image("vcss.png");
$test->add_attach_file("ip2nation.zip");
$test->html_body = file_get_contents("html_attachment.htm");
$test->text_body = strip_tags($test->html_body, "<a>");
$test->process_mail();
Thanks in advance.  Ces
« Last Edit: Aug 06, 2007, 03:26:08 AM by ces »
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Aug 06, 2007, 09:14:46 AM »

hello,

I use a kind of mail parser if I use some external html page:

inside the mail script use this kind of functions:

$tags['company_name'] = $_POST['company'];
$tags['from_country'] = $_POST['country'];
// add more
$tpl_str file_get_contents(tpl.html);
foreach (
$tags as $tag => $val) {
    
$tpl_str str_replace("{".$tag."}"$val$tpl_str);
}


and inside the file tpl.html  you have this kind of code:

Code:
Name, company name and city: {company_name}
Country (code): {from_country}


Last blog : Just a better Internet portal provided by Google
I crack Photoshop!
*
Posts: 3
22 credits
Members referred : 0


« Reply #2 on: Aug 06, 2007, 11:57:31 AM »

Olaf,

Thanks for the quick reply.
I tried to add your code to my test setup but i cannot get it to work.
In the HTML email shows the code {company} thats how i added it to the html_attachment.htm (as used in the example)
The code for the tags you provided i put after.
$test->add_attach_file("ip2nation.zip");
$tags['company_name'] = $_POST['company'];
$tags['from_country'] = $_POST['country'];
$test->html_body = file_get_contents("html_attachment.htm");
foreach ($tags as $tag => $val) {
    $tpl_str = str_replace("{".$tag."}", $val, $tpl_str);
}"

Could you please advice and or be more specific on how to use.
Sorry for the trouble.
Ces
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Aug 06, 2007, 12:05:30 PM »

this row must added later:

$test->html_body = file_get_contents("html_attachment.htm");

first you need to lead/edit the html file and than you need to add the attachment


Last blog : Just a better Internet portal provided by Google
I crack Photoshop!
*
Posts: 3
22 credits
Members referred : 0


« Reply #4 on: Aug 06, 2007, 12:28:51 PM »

Olaf, thanks again,
Unfortunately i dont get it to work.
My knowlidge about this is way to limited.  I tried several things to add your code but none seem to work.
Not your fold, it is me being to new to this stuff to understand.
I will use the txt mail example. That seems to work for me.
Thanks for your help.
Ces
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6440
39464 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: Aug 06, 2007, 01:53:02 PM »

yes that better, if you don't know how to use it, it's better to try something more simple


Last blog : Just a better Internet portal provided by Google
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=6984
Tags : Attechment mail class 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: Attachment mail class
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Nov 22, 2008, 02:55:12 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: 37.736
Total Topics: 7.650
Total Members: 4.396
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: thomas09

34 Guests, 4 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.