943,765 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 2161
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Oct 17th, 2008
0

mail() custom format?

Expand Post »
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
Similar Threads
Reputation Points: 31
Solved Threads: 10
Practically a Master Poster
OmniX is offline Offline
652 posts
since Dec 2007
Oct 17th, 2008
1

Re: mail() custom format?

means , you want to write some thing in that mail...Right????
if so,
see this..
php Syntax (Toggle Plain Text)
  1. $mail_body='<style type=text/css><!--td {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;}--></style>
  2. <table width="50%" border="0" align="center" cellpadding="1" cellspacing="0" bgcolor="#E7E7E7">
  3. <tr><td>[B]Do your design here...[/B]</td></tr>
  4. </table>';
  5.  
  6. mailto = 'some@some.com' ;
  7.  
  8. $mailheader = 'MIME-Version: 1.0' . "\r\n";
  9. $mailheader .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  10. $mailheader.=" From: someone\r\n";
  11. $mailheader .= 'BCc:some2@some.com' . "\r\n";
  12. @mail($mailto,' Details',$mail_body,$mailheader);
Last edited by Shanti C; Oct 17th, 2008 at 3:58 am.
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Oct 17th, 2008
0

Re: mail() custom format?

Ya using the mail function() http://www.php.net/mail.
Last edited by OmniX; Oct 17th, 2008 at 3:58 am.
Reputation Points: 31
Solved Threads: 10
Practically a Master Poster
OmniX is offline Offline
652 posts
since Dec 2007
Oct 17th, 2008
0

Re: mail() custom format?

see my above edited post....
if something else you want...let do post..
Last edited by Shanti C; Oct 17th, 2008 at 4:00 am.
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Oct 17th, 2008
0

Re: mail() custom format?

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:
php Syntax (Toggle Plain Text)
  1. $mailheader = 'MIME-Version: 1.0' . "\r\n";
  2. $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?

[code=html]
$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>Do your design here...</td></tr>
</table>';
[code]
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
Reputation Points: 31
Solved Threads: 10
Practically a Master Poster
OmniX is offline Offline
652 posts
since Dec 2007
Oct 17th, 2008
0

Re: mail() custom format?

yes,
To send HTML mail, the Content-type header must be set..
Quote ...
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
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Nov 4th, 2008
0

Re: mail() custom format?

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
Last edited by OmniX; Nov 4th, 2008 at 10:17 pm.
Reputation Points: 31
Solved Threads: 10
Practically a Master Poster
OmniX is offline Offline
652 posts
since Dec 2007
Nov 4th, 2008
1

Re: mail() custom format?

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
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Nov 5th, 2008
0

Re: mail() custom format?

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
Reputation Points: 31
Solved Threads: 10
Practically a Master Poster
OmniX is offline Offline
652 posts
since Dec 2007
Nov 13th, 2008
0

Re: mail() custom format?

help with the <img> tag please? Thanks
Reputation Points: 31
Solved Threads: 10
Practically a Master Poster
OmniX is offline Offline
652 posts
since Dec 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Name and Password login
Next Thread in PHP Forum Timeline: micro chat problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC