dongliufa6380 2018-11-23 05:53
浏览 47

如何使用phpmailer通过从数据库中获取电子邮件ID及其smtp配置来发送电子邮件

My php code for sending email using php mailer is

$email=new PHPMailer();
$email->isSMTP();
$email->SMTPDebug = 0;
$email->SMTPAuth = true;
$email->SMTPSecure=$smtpsecure;
$email->Host=$host;
$email->Port=$port;
$email->isHTML(true);
$email->Username=$sender;
$email->Password=$password;
$email->setFrom($sender);
$email->addAddress($recver);
$email->addAttachment($filename);
$email->send();

in this I want to take all details from database like sender,receiver,host,port,securetype
I like to use different emails to send mails like gmail,yahoo,outlook etc,
so i need to fetch ths smtp configuration from database

I all the above code is not working by putting smtp configurations directly it working fine,but while fetching from database not working

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用
    • ¥15 微信小程序协议怎么写
    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
    • ¥20 怎么用dlib库的算法识别小麦病虫害