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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How can I send html content?

Discussion in 'E-mail Discussions' 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:
    211
    Likes Received:
    13
    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.
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    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.
     
  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:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  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:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page