473,385 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Concatiniation of msg

Hi
i am sending mails to some attachment files. in this i will replace the string with some condition. i concatenate all this to $msg but we a problem in the body of the Message. that is it will repeated at how many time we handle the str_replace what can i do for this.
Expand|Select|Wrap|Line Numbers
  1. $msg .= "--".$mime_boundary.$eol;
  2.  $msg .= "Content-Type: text/plain; charset=iso-8859-1".$eol;
  3.   $msg .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
  4.   $msg .= strip_tags(str_replace("<br>", "\n", $Body)).$eol.$eol;
  5.  $msg .= str_replace("<br>", "\n", $Body).$eol.$eol;
  6.  $msg .= strip_tags(str_replace("<br />", "\n", $Body)).$eol.$eol;
  7.  $msg .= str_replace("<br />", "\n", $Body).$eol.$eol;
  8.   $msg .= strip_tags(str_replace("&nbsp;", " ", $Body)).$eol.$eol;
  9.  $msg .= str_replace("&nbsp;", " ", $Body).$eol.;
  10.  
Result of the Body will appear like this
Expand|Select|Wrap|Line Numbers
  1. Name :Akpovi Maxwell NoticePeriod : 15 / Days Salary :
  2. Month&nbsp;&nbsp;15000&nbsp;&nbsp;USD &nbsp; NegotiableAvailable From :
  3. &nbsp;======================================================= 
  4.  
  5. <br /><br />Name :Akpovi Maxwell <br />NoticePeriod : 15 / Days <br />Salary :
  6. Month&nbsp;&nbsp;15000&nbsp;&nbsp;USD &nbsp; <br />Negotiable<br />Available From :
  7. &nbsp;<br /><br />======================================================= <br />
  8.  
  9.  
  10.  
  11. Name :Akpovi Maxwell 
  12. NoticePeriod : 15 / Days 
  13. Salary : Month&nbsp;&nbsp;15000&nbsp;&nbsp;USD &nbsp; 
  14. Negotiable
  15. Available From : &nbsp;
  16.  
  17. ======================================================= 
  18.  
  19.  
  20.  
  21.  
  22. Name :Akpovi Maxwell 
  23. NoticePeriod : 15 / Days 
  24. Salary : Month&nbsp;&nbsp;15000&nbsp;&nbsp;USD &nbsp; 
  25. Negotiable
  26. Available From : &nbsp;
  27.  
  28. ======================================================= 
  29.  
  30.  
  31. Name :Akpovi Maxwell NoticePeriod : 15 / Days Salary : Month  15000  USD  
  32. NegotiableAvailable From :  ======================================================= 
  33.  
  34. <br /><br />Name :Akpovi Maxwell <br />NoticePeriod : 15 / Days <br />Salary : Month
  35.  15000  USD   <br />Negotiable<br />Available From :  <br /><br
  36. />======================================================= <br />
  37.  
Thankyou
Feb 1 '08 #1
1 1078
dlite922
1,584 Expert 1GB
Hi
i am sending mails to some attachment files. in this i will replace the string with some condition. i concatenate all this to $msg but we a problem in the body of the Message. that is it will repeated at how many time we handle the str_replace what can i do for this.
Expand|Select|Wrap|Line Numbers
  1. $msg .= "--".$mime_boundary.$eol;
  2. $msg .= "Content-Type: text/plain; charset=iso-8859-1".$eol;
  3. $msg .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
  4. $msg .= strip_tags(str_replace("<br>", "\n", $Body)).$eol.$eol;
  5. $msg .= str_replace("<br>", "\n", $Body).$eol.$eol;
  6. $msg .= strip_tags(str_replace("<br />", "\n", $Body)).$eol.$eol;
  7. $msg .= str_replace("<br />", "\n", $Body).$eol.$eol;
  8. $msg .= strip_tags(str_replace("&nbsp;", " ", $Body)).$eol.$eol;
  9. $msg .= str_replace("&nbsp;", " ", $Body).$eol.;
  10.  
Result of the Body will appear like this
Expand|Select|Wrap|Line Numbers
  1. Name :Akpovi Maxwell NoticePeriod : 15 / Days Salary :
  2. Month&nbsp;&nbsp;15000&nbsp;&nbsp;USD &nbsp; NegotiableAvailable From :
  3. &nbsp;======================================================= 
  4.  
  5. <br /><br />Name :Akpovi Maxwell <br />NoticePeriod : 15 / Days <br />Salary :
  6. Month&nbsp;&nbsp;15000&nbsp;&nbsp;USD &nbsp; <br />Negotiable<br />Available From :
  7. &nbsp;<br /><br />======================================================= <br />
  8.  
  9.  
  10.  
  11. Name :Akpovi Maxwell 
  12. NoticePeriod : 15 / Days 
  13. Salary : Month&nbsp;&nbsp;15000&nbsp;&nbsp;USD &nbsp; 
  14. Negotiable
  15. Available From : &nbsp;
  16.  
  17. ======================================================= 
  18.  
  19.  
  20.  
  21.  
  22. Name :Akpovi Maxwell 
  23. NoticePeriod : 15 / Days 
  24. Salary : Month&nbsp;&nbsp;15000&nbsp;&nbsp;USD &nbsp; 
  25. Negotiable
  26. Available From : &nbsp;
  27.  
  28. ======================================================= 
  29.  
  30.  
  31. Name :Akpovi Maxwell NoticePeriod : 15 / Days Salary : Month 15000 USD 
  32. NegotiableAvailable From : ======================================================= 
  33.  
  34. <br /><br />Name :Akpovi Maxwell <br />NoticePeriod : 15 / Days <br />Salary : Month
  35. 15000 USD <br />Negotiable<br />Available From : <br /><br
  36. />======================================================= <br />
  37.  
Thankyou
i assume you know what str_replace() and strip_tags() do.

Print $body after the following combinations.

str_replace() on all the combinations of <br> (hint use regular express)

then just declare ONE strip_tags() on it, and die($body) and see what you get.
Feb 2 '08 #2

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.