Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    Jun 2009
    Posts
    351
    Thanks
    75
    Thanked 0 Times in 0 Posts

    How to correctly format an email in php

    Hi set up a mail function like this

    PHP Code:
        mail($email,"AdsInDublin - Upgrade Your Free Ad To A Premium Ad For Only €5"
                    
    "Upgrade Your Ad To Premium For Better Responses!<br /><br />
                    This email is regarding your Ad. <a href='http://www.adsindublin.com/freeads/{$id}'> {$title} </a> posted on AdsInDublin.com.<br /><br />
                    Are you getting the responses you hoped for? If not you have the option to upgrade your ad to a Premium Ad. There are a number 
                    of advantages of upgrading your ad to a premium ad. First of all your ad will imediately get moved to the first ad on the first page of the website and will stay 
                    there until another person upgrades there ad. Your ad will also be displayed on the right hand column of every page of the website ensuring maximum exposure. Your ad
                    will also stay on top of the listing in the category you have placed your ad in.<br /><br />
                    To convert your ad to Premium, login to AdsInDublin.com and go to this address http://www.adsindublin.com/classified/premium/id/{$id} <br /><br />
                    If you have any questions or need help creating a premium ad please email us on info@adsindublin.com.<br /><br />
                    Thanks<br /><br />
                    AdsInDublin.com<br />
                    
                "
    $headers); 
    and when i get an email it comes out exactly like the above.. How do i format it in such a way that it comes out like the following..

    ______________________________________________________

    Upgrade Your Ad To Premium For Better Responses!

    This email is regarding your Ad. <a href='http://www.adsindublin.com/freeads/{$id}'> {$title} </a> posted on AdsInDublin.com.

    Are you getting the responses you hoped for? If not you have the option to upgrade your ad to a Premium Ad. There are a number of advantages of upgrading your ad to a premium ad. First of all your ad will immediately get moved to the first ad on the first page of the website and will stay there until another person upgrades there ad. Your ad will also be displayed on the right hand column of every page of the website ensuring maximum exposure. Your adwill also stay on top of the listing in the category you have placed your ad in.

    To convert your ad to Premium, login to AdsInDublin.com and go to this address http://www.adsindublin.com/classified/premium/id/{$id}

    If you have any questions or need help creating a premium ad please email us on info@adsindublin.com.

    Thanks
    AdsInDublin.com

  • #2
    Regular Coder
    Join Date
    Sep 2007
    Posts
    809
    Thanks
    5
    Thanked 2 Times in 2 Posts
    I'm PHP guru by any means, but I think you need to make the format of the email HTML, by doing something like so...

    PHP Code:
    $headers "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=sio-8859-1\r\n";
    $headers .= "FROM: youremail@yourdomain.com";
    mail($to$subject$emailbody$headers); 
    Hope this is some help!

  • #3
    Regular Coder
    Join Date
    Jun 2009
    Posts
    351
    Thanks
    75
    Thanked 0 Times in 0 Posts
    yes i have that.. but when i get an email..

    The txt is all over the place and is not correctly formatted

  • #4
    Regular Coder
    Join Date
    Sep 2007
    Posts
    809
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by kevinkhan View Post
    yes i have that.. but when i get an email..

    The txt is all over the place and is not correctly formatted
    Oh in that case, I'm not sure I can help any further...

    I've just taken that code from a working example of mine, so I'm not really sure why it won't work for you

  • #5
    Regular Coder
    Join Date
    Jun 2009
    Posts
    351
    Thanks
    75
    Thanked 0 Times in 0 Posts
    it works alright. I get an email.. its just when i get the email im getting <br /> tags displayed and not an actual break line

  • #6
    Regular Coder
    Join Date
    Sep 2007
    Posts
    809
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by kevinkhan View Post
    it works alright. I get an email.. its just when i get the email im getting <br /> tags displayed and not an actual break line
    I have line breaks in mine, but I have used <br/> rather than <br />, although to be honest I can't see that being the cause of the problem!

    What email client are you viewing the email in, just out of interest?

  • Users who have thanked greens85 for this post:

    kevinkhan (02-22-2010)

  • #7
    Regular Coder
    Join Date
    Jun 2009
    Posts
    351
    Thanks
    75
    Thanked 0 Times in 0 Posts
    thunderbird..

    i have taken out the <br /> tags and put no html tage for the $body variable and just used the enter button to seperate lines and when i get email this is how it gets displayed..

    Its weird.. hard to describe

  • #8
    Regular Coder
    Join Date
    Jun 2009
    Posts
    351
    Thanks
    75
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by greens85 View Post
    I'm PHP guru by any means, but I think you need to make the format of the email HTML, by doing something like so...

    PHP Code:
    $headers "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=sio-8859-1\r\n";
    $headers .= "FROM: youremail@yourdomain.com";
    mail($to$subject$emailbody$headers); 
    Hope this is some help!
    Sorry you are right i forgot the $headers

    the html tags works now

    Do hotmail gmail etc support this by default?

  • #9
    Regular Coder
    Join Date
    Sep 2007
    Posts
    809
    Thanks
    5
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by kevinkhan View Post
    Sorry you are right i forgot the $headers

    the html tags works now

    Do hotmail gmail etc support this by default?
    I have previously used a hotmail account to view emails generated in the same manner, and experienced no issues... so all should be well.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •