如何从特定的 IP 地址发送电子邮件? [英] How to send email from a specific ip address?

查看:57
本文介绍了如何从特定的 IP 地址发送电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 cPanel/CentOS 运行 vps,并且我想动态地选择 IP 地址以从 php 代码中发送电子邮件.(我对任何奇怪的方式持开放态度)

I'm running a vps with cPanel/CentOS, And i want to dynamically choose the IP address to send an email from right inside the php code. ( i'm open to any weired ways )

有没有办法做到这一点?我真的很感激一些清晰的想法,因为我不擅长 exim 和其他东西.

Is there any way to do that? i would really appreciate some clear ideas as i'm not that good at exim and stuffs.

附:我已经在 WHM 中有可用的 IP.

P.S. i already have available IPs in WHM.

谢谢

推荐答案

您可以通过使用sendmail并传递参数来定义要使用的配置文件来实现这一点.在配置文件中,您可以使用 伪装和中继 选项与 CLIENT_OPTIONS(`Addr=aaa.bbb.ccc.ddd') 一起通过某个 IP 发送.

You can achieve this by using sendmail and passing parameters to define the configuration file to use. Inside the configuration file you can use the Masquerading And Relaying options together with CLIENT_OPTIONS(`Addr=aaa.bbb.ccc.ddd') to send via a certain IP.

使用 PHP mail 时使用 additional_parameters 指定要使用的 sendmail 配置文件,并在该配置文件中使用上述选项进行配置.

When using PHP mail use the additional_parameters to specify the sendmail config file to use and in that config file use the above options to configure it.

这篇关于如何从特定的 IP 地址发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆