SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2010
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    break line message body

    Hi
    we had problem in our email system. the break line '\n' in the message body doesn't work in the email client I try to change it to <br/> tags but no use I test my code in browser it work fine.can you help me and thank you
    PHP Code:
        $message "Hi $FirstName!" ."<br/>".
                
    "Your Account for the Web has been created! Your information is below:" ."<br/>".        
                
    "Username:"$username."<br/>".
                
    "Temporary Password (change it when you log-in):"$PlainTextPassword ."<br/>".
                
                
    "To log in, go to "  ."<br/>".
                
    "Make sure you change your password and update your profile information immediately upon logging in!""<br/>".
                
    "The site is best viewed with FireFox.""<br/>".
                
    $fromName

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Adding a HTML break (<br />) will only work if you're sending the email with the appropriate HTML headers, are you doing this?
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2010
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the previews Developer use the PHPMailer class I don't know how to add the headers into the code

    PHP Code:
            $fromEmail "info@studentsofferingsupport.ca";
            
    $fromName "Info";
            
    $toEmail $_POST['PrimaryEmail'];
            
    $toName $_POST['FirstName']." ".$_POST['LastName'];
            
    $subject "SOS PORTAL New Account Information";
            
    $message "Hi $FirstName!" ."<br/>"
                
    "Your Account for the Web has been created! Your information is below:" ."<br/>".         
                
    "Username:"$username."<br/>"
                
    "Temporary Password (change it when you log-in):"$PlainTextPassword ."<br/>"
                 
                
    "To log in, go to "  ."<br/>"
                
    "Make sure you change your password and update your profile information immediately upon logging in!""<br/>"
                
    "The site is best viewed with FireFox.""<br/>"
                
    $fromName;  
            
            require_once(
    PORTAL_PATH '/Communication/functions.php');
            require_once(
    PORTAL_PATH'/include/PHPMailer_v2.0.4/class.phpmailer.php');
            
            
    $mail = new PHPMailer();
                
            
    $mail->IsSMTP();                                      // set mailer to use SMTP
            
    $mail->Host "www.hhhh.com";  // specify main and backup server
            
    $mail->SMTPAuth true;     // turn on SMTP authentication
            
    $mail->Username "info@hhhh.com";  // SMTP username
            
    $mail->Password "info"// SMTP password
            
    $mail->Priority=1;
            
            
    $mail->From $fromEmail;
            
    $mail->FromName $fromName;
            
    $mail->AddAddress($toEmail$toName);
            
    $mail->AddReplyTo($fromEmail$fromName);
            
            
    $mail->WordWrap 70;                                 // set word wrap to 90 characters
            
    $mail->IsHTML(false);                                  // set email format to HTML
            
    $mail->Subject $subject;
            
            
    $mail->Body $message;
            
            
    $mail->Send(); 

  4. #4
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Pass TRUE to the IsHTML method instead of FALSE
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2010
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks


Bookmarks

Posting Permissions

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