Promblem in email header

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • waqasahmed996
    New Member
    • Jun 2008
    • 160

    Promblem in email header

    hi to all

    i am unable to send email using header. i used code
    Code:
              $from =  $row['mail_from'];
              $subject =  $row['subject'];
              $head =  $row['header'];
    
              $Mail_header  = "Content-type: text/html\n";
              $Mail_header .= "From: $head <$from> \n";
              $msg =  $ro['message'];
    using above code value of $from is not show may be because of symbols of "<" and ">" and thats why mail is not sent

    then i used code

    Code:
              $from =  $row['mail_from'];
              $subject =  $row['subject'];
              $head =  $row['header'];
    
              $Mail_header  = "Content-type: text/html\n";
              $Mail_header .= "From: $head &lt;$from&gt; \n";
              $msg =  $ro['message'];
    by using above code value of variable $from is got but still unable to send email.
    please give me some solution
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    there are some mail classes out, that make sending emails far easier than PHP's mail() function.
    for instance Swift Mailer

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      Also, line 7 you have a typing mistake. $ro should be $row.

      Do you get any errors? Any output? What does happen? What doesn't happen?

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        Hi.

        The &lt; and &gt; symbols are HTML symbols. Why would you put them in an email header?

        Anyhow, the manual provides excellent examples of how to construct the headers for HTML emails (example #4).
        Try replicating the syntax used there.

        Also, from the link I posted above:
        Originally posted by PHP Manual
        Multiple extra headers should be separated with a CRLF (\r\n).

        Comment

        Working...