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

查看:458
本文介绍了如何从特定的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 )

有没有办法做到这一点?我会很欣赏一些明确的想法,因为我不擅长进出口或其他东西.

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

P.S.我已经在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天全站免登陆