有人可以帮我解决我的邮件功能问题。
我想在表格和附件中接收文本值。现在我收到的是表格代码而不是代码输出和附件。
如果我删除了我为附件做的修改,那么我得到正确的输出但只有文本。
public abstract class Fruit implements Comparable<Fruit> {
public abstract String getName();
public abstract Integer getWeightInGrams();
@Override
public final int compareTo(Fruit other)
{
return getName().compareTo(other.getName());
}
}
public class Orange extends Fruit {
private final Integer weightInGrams;
public Orange(int weightInGrams)
{
this.weightInGrams = weightInGrams;
}
@Override
public String getName()
{
return "Orange";
}
@Override
public Integer getWeightInGrams()
{
return weightInGrams;
}
}
//Or just using comparators (in which case Fruit does not need to implement Comparable):
public class FruitWeightComparator implements Comparator<Fruit> {
@Override
public int compare(Fruit o1, Fruit o2)
{
return o1.getWeightInGrams().compareTo(o2.getWeightInGrams());
}
}
public class FruitNameComparator implements Comparator<Fruit> {
@Override
public int compare(Fruit o1, Fruit o2)
{
return o1.getName().compareTo(o2.getName());
}
}
答案 0 :(得分:0)
是因为你有这一行:
$body .= "Content-Type: text/plain; charset=ISO-8859-1\r\n";
所有代码都在text-plain
中发送,将其删除并在text/html
中更改为$header
:
$header .= 'MIME-Version: 1.0\r\n';
$header .= 'Content-type: text/html; charset=iso-8859-1\r\n';