Advertisement

05.13.2008 at 05:37AM PDT, ID: 23397447
[x]
Attachment Details

How do I attach background image to the mail?

Asked by logudotcom in PHP Scripting Language

Tags: php mailer, background image, newsletter, php mailing list

I want to attach background image to my mail. I am using phpmailer classes to send the mails. I can send mails with headers + image attachment  ... but not the image background attached mail ... the below is the attached script which i am working?

i want the "background="images/prayer_dove.jpg" to be applied on my mail ... mails are sent / received in my inbox ... but no background image attached with that ...

any ideas would be much appreciated .Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
<?php
 
include_once('classes/class.phpmailer.php');
 
 
$mail    = new PHPMailer();
 
$body		='<body background="images/prayer_dove.jpg"  style="margin: 0px;">
			<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
			<div align="center"><img src="images/bg_head.jpg" width="622" height="73" ></div>
			<br>
			<br>
			&nbsp;Dear '.$toname	.'<br>This is a test of PHPMailer v2.0.0 rc1.<br>
			<br>
			This particular example uses <strong>HTML</strong>, with a &lt;div&gt; tag and inline<br>
			styles.<br>
			<br>
			Also note the use of the PHPMailer at the top with no specific code to handle
			including it in the body of the email.<br>Notice how this is 
			different from a script written in other languages like Perl or C -- instead of writing a program with lots of commands to output HTML, you write an HTML script with some embedded code to do something (in this case, output some text). 
			The PHP code is enclosed in special start and end tags that allow you to jump into and out of "PHP mode". 
			What distinguishes PHP from something like client-side JavaScript is that the code is executed on the server. 
			If you were to have a script similar to the above on your server, the client would receive the 
			results of running that script, with no way of determining what the underlying code may be.
			 You can even configure your web server to process all your HTML files with PHP, and then 
			 theres really no way that users can tell what you have up your sleeve. 
			The best things in using PHP are that it is extremely simple for a newcomer, but offers many 
			advanced features for a professional programmer. Dont be afraid reading the long list of PHPs 
			features. You can jump in, in a short time, and start writing simple scripts in a few hours. 
			
			Although PHPs development is focused on server-side scripting, you can do much more with it.
			 Read on, and see more in the What can PHP do? section. 
			
</div>
			</body>';
$body    = eregi_replace("[\]",'',$body);
$subject = eregi_replace("[\]",'',$subject);
$mail->From     = "test2@gmail.com";
$mail->FromName = "TESTER";
 
$mail->Subject = "This is test BG test";
 
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
 
$torediff="test@rediffmail.com";
$togmail="test@gmail.com";
$toyahoo = "logu@test.com";
$toname="Logu";
 
$mail->AddAddress($toyahoo,$toname);
 
$mail->AddCC($torediff,$toname);
 
$mail->AddBCC($togmail,$toname);
 
$mail->MsgHTML($body); //important function
 
 
if(!$mail->Send()) {
  echo 'Failed to send mail';
} else {
  echo 'Mail sent';
}
 
?>
[+][-]05.13.2008 at 05:50AM PDT, ID: 21554477

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.13.2008 at 08:56AM PDT, ID: 21556330

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.13.2008 at 10:21AM PDT, ID: 21557217

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.13.2008 at 02:15PM PDT, ID: 21559343

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP Scripting Language
Tags: php mailer, background image, newsletter, php mailing list
Sign Up Now!
Solution Provided By: nplib
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628