使用PHP发送完整的HTML邮件

时间:2019-03-09 19:21:07

标签: php html email

我想发送带有PHP邮件功能的电子邮件,但是我的HTML以纯文本格式发送。

这是我的代码:

public class MyMain {

    public static void main(String[] args) throws Throwable {
        MethodHandles.Lookup lookup = MethodHandles.lookup();
        CallSite site = LambdaMetafactory.metafactory(lookup,
                "apply",
                MethodType.methodType(Function.class),
                MethodType.methodType(Object.class, Object.class), // Function::apply signature
                lookup.findVirtual(Person.class, "getName", MethodType.methodType(String.class)),
                MethodType.methodType(String.class, Person.class) // Person::getName signature
        );

        Function<Person, String> getterFunction = (Function<Person, String>) site.getTarget().invokeExact();

        System.out.println(getterFunction.apply(new Person("Ann")));
    }

    static class Person {
        String name;

        public Person(String name) {
            this.name = name;
        }

        public String getName() {
            return name;
        }
    }

}

谢谢!

1 个答案:

答案 0 :(得分:1)

您的标头应为以下数组:

<html>
<head>
    <script src="x-counter.js"></script>
<body>
    <x-counter></x-counter>

此外,没有内容将内容设置为php文件,内部内容将读取为html,将不会执行php代码;