douwen1937 2012-07-13 10:45
浏览 298
已采纳

来自MySQL的纯文本电子邮件

The situation is the following. I stored a plain text email in MySQL containing linebreaks as . When my php script needs to send the mail it first fills in some parameters with sprintf and then the mail is sent with the standard mail() function.

The problem I encounter is that the email client (thunderbird in my case) displays these linebreaks instead of interpreting them.

To test my script I hardcoded a sentence in the mail. When I do this the mail is interpreted correctly. My first tought was that MySQL escapes the backslashes, so I tried to do a str_replace("\\\\", "\\", $str) but this doesn't help.

I'm obviously making a wrong assumption or stupid error, but I don't see it. What could be the problem?

  • 写回答

3条回答 默认 最新

  • donglulong0877 2012-07-13 11:40
    关注

    try to replace it like this str_replace(' ', " "); It might solve your problem if the characters are saved in you message as four seperate characters. If you have inputted them using for example phpmyadmin they will be saves as 4 characters and not 2 characters as you expect.

    Hope it helps!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题