Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How can I send html content?

Discussion in 'E-mail Discussion' started by ortodata, Apr 12, 2017.

  1. ortodata

    ortodata Registered

    Joined:
    Apr 12, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Brazil
    cPanel Access Level:
    Website Owner
    How can I send html content and send attached files via email?
     
  2. Eminds

    Eminds Well-Known Member

    Joined:
    Nov 10, 2016
    Messages:
    267
    Likes Received:
    20
    Trophy Points:
    18
    Location:
    India
    cPanel Access Level:
    Root Administrator
    This question is actually irrespective of Cpanel , please try asking on other hosting forums and you may receive good guidelines on it.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,378
    Likes Received:
    1,857
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Sending HTML content or attaching files to an email is possible. The method to do so depends on the email or webmail client you are using.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. ortodata

    ortodata Registered

    Joined:
    Apr 12, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Brazil
    cPanel Access Level:
    Website Owner
    Thank You!

    I am using this code I get in cPanel's forum by: Send Email From PHP Using SMTP Authentication (Guide)


    PHP:
    <?php
    require_once "Mail.php";
    $from "MyName <name@myemail.com>";
    $to "TargetName <name@targetemail.com>";
    $subject "Hi!";
    $body "Hi,\n\nHow are you?";
    $host "mail.mailserver.com";
    $username "name@myemail.com";
    $password "my_password";
    $headers = array ('From' => $from,
    'To' => $to,
    'Subject' => $subject);
    $smtp Mail::factory('smtp',
    array (
    'host' => $host,
    'auth' => true,
    'username' => $username,
    'password' => $password));
    $mail $smtp->send($to$headers$body);
    if (
    PEAR::isError($mail)) {
    echo(
    "<p>" $mail->getMessage() . "</p>");
    } else {
    echo(
    "<p>Message successfully sent!</p>");
    }
    ?>
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,378
    Likes Received:
    1,857
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. ortodata

    ortodata Registered

    Joined:
    Apr 12, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Brazil
    cPanel Access Level:
    Website Owner
    I can try, but no example has the line "require_once" Mail.php ";
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,378
    Likes Received:
    1,857
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice