Anyone know how to get a custom layout when sending email's via mail()?

At the moment I would just like to start a new line in an email but eventually throw in images and etc.

Any information be much appericated.

Regards, X

Recommended Answers

All 10 Replies

means , you want to write some thing in that mail...Right????
if so,
see this..

$mail_body='<style type=text/css><!--td {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;}--></style>
<table width="50%"  border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#E7E7E7">
  <tr><td>[B]Do your design here...[/B]</td></tr>
</table>';

mailto = 'some@some.com' ;	
	
	$mailheader  = 'MIME-Version: 1.0' . "\r\n";
	$mailheader .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";	
	$mailheader.=" From: someone\r\n";
	$mailheader .= 'BCc:some2@some.com' . "\r\n";
	@mail($mailto,' Details',$mail_body,$mailheader);
commented: Nice code Shanti, Thankyou! +1

see my above edited post....
if something else you want...let do post..

Hi shanti!

I have retired for the day and obligated over the weekend but I will try get it next week. Just for some confirmations:

$mailheader  = 'MIME-Version: 1.0' . "\r\n";
$mailheader .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";  

These lines allow you to maniuplate the email into html? if not what purpose they serve?

$mail_body='<style type=text/css><!--td {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;}--></style>
<table width="50%"  border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#E7E7E7">
  <tr><td>[b]Do your design here...[/b]</td></tr>
</table>';

I put similar tags in my email and they just came out as normal <tr>, etc but I guess your decleration in the header will allow this to be formatted as html than rather text? This correct?

Thanks, Regards X

yes,
To send HTML mail, the Content-type header must be set..

I guess your decleration in the header will allow this to be formatted as html than rather text? This correct?

right....

For more details see this

Thanks Shanti, works like a gem.

Now I just need something creative.

You have any idea on how to send images along with the email?

would be a simply img refer to an image on the server?

Also any other fancy ideas you have will be much appericated.

Thanks, Regards X

i generally used img tag to send images through my mail function...it gives me no error at all....if you know any other fancy ideas,post here for all daniweb members..

thanks omnix

commented: Good Conversation Firend!!!!! +1

As I get them I will.

My basic aim is to re-create a webpage in an email, with all images, etc.

How did you post the image?

I tried the <img src="server"> and it didnt work came up as an X (not loaded).

If I get any cool ideas ill let you know but objective is to basically recreate a small webpage in the email (that would be cool).

Thanks, Regards X

help with the <img> tag please? Thanks

I dont know how this thread was marked solved, must have been when my internet was capped.

I am still waiting to see if anyone can help me with using the <img> tag within an email.

The problem is when u refer to a src="" element that is on the server can obviously cant connect when in their email so would I need to upload an image global like photobucket etc?

So how would I do that on my own server?
or am I completely wrong and lost?

HELP PLEASE!?!??!

Intial Question is: How do I use the <img> tag within an email?

Thanks, Regards X

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.