email() & port number

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
weazel
Forum Newbie
Posts: 3
Joined: Wed Jun 19, 2002 4:44 am
Location: Germany

email() & port number

Post by weazel »

In my company we have en experimentel smtp-server which runs on port 26. Is there any way to tell the php mail function to use port 26 instead of 25 for sending mail?

greetz
weazel
Zmodem
Forum Commoner
Posts: 84
Joined: Thu Apr 18, 2002 3:59 pm

Post by Zmodem »

Yes, most SMTP servers will let you configure it to listen on a different port. But how you go about this varies from server to server.

What software ya using?
User avatar
fatal
Forum Contributor
Posts: 118
Joined: Sat Apr 20, 2002 10:47 am
Location: East Coast

Post by fatal »

when you put in your SMTP server in, ex:'mail.mirci.com'. Add a port number at the end, 'mail.mirci.com:26'

That could help you out somewhat.
Zmodem
Forum Commoner
Posts: 84
Joined: Thu Apr 18, 2002 3:59 pm

Post by Zmodem »

DOH! I misread, sorry.

Note to self - Get more coffee before answering questions in the forums :/
User avatar
weazel
Forum Newbie
Posts: 3
Joined: Wed Jun 19, 2002 4:44 am
Location: Germany

Post by weazel »

Zmodem wrote:DOH! I misread, sorry.
Get more coffee ... snip
Yeah that would help a lot :D

This thing with just attaching the port number to the domain doesn't seem to work. This is a fragment of my script:

Code: Select all

$strSubject = "none";
$strMessage = "some text";
$strHeaders = "From: me@mydomain.com:26\r\nReply-To:webmaster@mydomain.com";
if (!mail($arrayї"eMail"], $strSubject, $strMessage, $strHeaders))
{
 // do s.th. special
 }
I think I did it right with the port number ..
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You have to add the port number to where you specify the SMTP server in the php.ini file.

Mac
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Mail functions
...
SMTP string
Used under Windws only: DNS name or IP address of the SMTP server PHP should use for mail sent with the mail() function.

SMTP int
Used under Windws only: Number of the port to connect to the server specified with the SMTP setting when sending mail with mail(); defaults to 25. Only available since PHP 4.3.0.
...
on unix the local mailer is used. So this one has to be set up to use another port (if it uses sockets to connect the next MTA)
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Only available since PHP 4.3.0
So when that's released as a stable version you're set.

Mac
User avatar
weazel
Forum Newbie
Posts: 3
Joined: Wed Jun 19, 2002 4:44 am
Location: Germany

Damn!

Post by weazel »

Well, port 26 still doesn't work because of PHP4.2.0 :cry: and now port 25 doesn't want anymore too... I think I shot s.th. :roll:

/*add
Now it's working again and with port 26 too :D
Two new routing rules thats all.

Thanks for your help, pals :)
*/
Post Reply