WEB PHP email

Discussion in 'OT Technology' started by Coaxsist, Nov 16, 2009.

  1. Coaxsist

    Coaxsist Re-create... Innovate

    Joined:
    Feb 11, 2008
    Messages:
    1,032
    Likes Received:
    0
    Me again,

    I kinda know what I'm doing w/ PHP now, but I have no idea where to change the content header of an email so that it displays as html.

    My first assumption is in the email itself but that cant be right...

    Do I send the email to a php file, which I get back as html, then send that? But that seems inefficient...

    Halp?
     
  2. fishbulb

    fishbulb Active Member

    Joined:
    Oct 29, 2001
    Messages:
    6,848
    Likes Received:
    4
    Location:
    md
  3. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
  4. brds

    brds OT Supporter

    Joined:
    Jun 26, 2006
    Messages:
    17,643
    Likes Received:
    14
    Location:
    Atlanta
    For some reason, i read "me again" in a Billy Mayes voice.

    But yes, look into "mail" function.
     
  5. Coaxsist

    Coaxsist Re-create... Innovate

    Joined:
    Feb 11, 2008
    Messages:
    1,032
    Likes Received:
    0
    Ok, the mail function.
    Where do I put the actual script? In the actual message that will be sent out?
    Or do I have to manually run a php file from my webspace? I have no idea about that part...

    I put together this from the php dot net link above:
    Code:
    <?php
    
    $to = [email protected]'. ',';
    
    $subject = 'Test HTML email';
    
    $message = wordwrap($message, 70);
    $message = '
    <html>
    <head>
    <title>Test HTML email</title>
    <style type="text/css">
    body {
    background-color: #fff;
    }
    
    p {
    font-weight: bold;
    font-size: 19px;
    }
    </style>
    </head>
    
    <body>
        <div align="center">
            <p>This is the first HTML email w/ PHP.</p>
            
            <a href="http://www.strideclubstudios.com/" target=_blank"><img src="http://www.kylenystrom.com/exampleimage.jpg" /></a>
            
            <p>This is some more text here. And here. And here again.</p>
        </div>
    </body>
    </html>';
    
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
    // Why would I put this in again, when I've specified the same parameters above?
    mail($to, $subject, $message, $headers); //never mind, this is the actual function, and above are variables...
    ?>
    
    Everything look okay? I've only seen tables used in the $message section. Okay to use divs?
     
    Last edited: Nov 17, 2009
  6. Coaxsist

    Coaxsist Re-create... Innovate

    Joined:
    Feb 11, 2008
    Messages:
    1,032
    Likes Received:
    0
    Thanks for your help gais! :bigthumb:
     

Share This Page