By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,335 Members | 2,718 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,335 IT Pros & Developers. It's quick & easy.

Sending a mail through exchange server

P: n/a
I want to send mail through PHP using the MS Exchange server.
My php.ini file looks like this (for the MAIL functions)
-------
[mail function]
; For Win32 only.
SMTP = exchgserver.test.com
smtp_port = 25

; For Win32 only.
sendmail_from = th********@test.com
-------
The following extensions have been loaded as well.
extension=php_imap.dll
extension=php_ldap.dll
After making these changes there were no errors/warnings. But I'm
unable to send any mails.
What are the other changes that i should do to send mails?

May 29 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Rajendran wrote:
I want to send mail through PHP using the MS Exchange server.
My php.ini file looks like this (for the MAIL functions)
-------
[mail function]
; For Win32 only.
SMTP = exchgserver.test.com
smtp_port = 25

; For Win32 only.
sendmail_from = th********@test.com
-------
The following extensions have been loaded as well.
extension=php_imap.dll
extension=php_ldap.dll
After making these changes there were no errors/warnings. But I'm
unable to send any mails.
What are the other changes that i should do to send mails?
try sending mail with a mail client like thunderbird
and see if that succeeds or fails
if that also fails it could give a clue about whats happening

greets
pacal
May 29 '07 #2

P: n/a
Rajendran wrote:
I want to send mail through PHP using the MS Exchange server.
My php.ini file looks like this (for the MAIL functions)
-------
[mail function]
; For Win32 only.
SMTP = exchgserver.test.com
smtp_port = 25

; For Win32 only.
sendmail_from = th********@test.com
-------
The following extensions have been loaded as well.
extension=php_imap.dll
extension=php_ldap.dll
After making these changes there were no errors/warnings. But I'm
unable to send any mails.
What are the other changes that i should do to send mails?
Do you actually have host exchgserver.test.com? What happens if you try
to ping it from your command line?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 29 '07 #3

P: n/a
On May 29, 11:51 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Rajendran wrote:
I want to send mail through PHP using the MS Exchange server.
My php.ini file looks like this (for the MAIL functions)
-------
[mail function]
; For Win32 only.
SMTP = exchgserver.test.com
smtp_port = 25
; For Win32 only.
sendmail_from = thegood...@test.com
-------
The following extensions have been loaded as well.
extension=php_imap.dll
extension=php_ldap.dll
After making these changes there were no errors/warnings. But I'm
unable to send any mails.
What are the other changes that i should do to send mails?

Do you actually have host exchgserver.test.com? What happens if you try
to ping it from your command line?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
When I try to ping that server it says "Request Time out"
I've configured my outlook with this server and I'm using it to send
and receive mails.

<?php
//change this to your email.
$to = "ra*@yahoo.com";
$from = "ra*@test.com";
$subject = "Hello! This is HTML email";
//begin message
$message = <<<EOF
<html>
<body bgcolor="#DCEEFC">
<center>
<b>Looool!!! I am reciving HTML email......</b<br>
<font color="red">Thanks!</font<br>
<a href="http://www.gmail.com/">Gmail</a>
</center>
<br><br>*** Now you Can send HTML Email through PHP<br>
Regards<br>Rajen
</body>
</html>
EOF;
//end of message
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
$to = "$to, $from"; // this will send to both emails at the same
time.
// now lets send the email.
$mail_sent = @mail($to, $subject, $message, $headers);
echo $mail_sent ? "Mail sent" : "Mail failed";
?>
That is the php script which i copied from phpfreaks.com

May 30 '07 #4

P: n/a
Rajendran wrote:
On May 29, 11:51 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>Rajendran wrote:
>>I want to send mail through PHP using the MS Exchange server.
My php.ini file looks like this (for the MAIL functions)
-------
[mail function]
; For Win32 only.
SMTP = exchgserver.test.com
smtp_port = 25
; For Win32 only.
sendmail_from = thegood...@test.com
-------
The following extensions have been loaded as well.
extension=php_imap.dll
extension=php_ldap.dll
After making these changes there were no errors/warnings. But I'm
unable to send any mails.
What are the other changes that i should do to send mails?
Do you actually have host exchgserver.test.com? What happens if you try
to ping it from your command line?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================

When I try to ping that server it says "Request Time out"
I've configured my outlook with this server and I'm using it to send
and receive mails.

<?php
//change this to your email.
$to = "ra*@yahoo.com";
$from = "ra*@test.com";
$subject = "Hello! This is HTML email";
//begin message
$message = <<<EOF
<html>
<body bgcolor="#DCEEFC">
<center>
<b>Looool!!! I am reciving HTML email......</b<br>
<font color="red">Thanks!</font<br>
<a href="http://www.gmail.com/">Gmail</a>
</center>
<br><br>*** Now you Can send HTML Email through PHP<br>
Regards<br>Rajen
</body>
</html>
EOF;
//end of message
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
$to = "$to, $from"; // this will send to both emails at the same
time.
// now lets send the email.
$mail_sent = @mail($to, $subject, $message, $headers);
echo $mail_sent ? "Mail sent" : "Mail failed";
?>
That is the php script which i copied from phpfreaks.com
A lousy script - html email should always be sent multipart - with text
and html parts. But that's beside the point.

What errors do you get? "It doesn't work" isn't very descriptive.

The fact you can't ping the server may be telling - or it may not. It's
possible the server is not available from your webserver; but it's also
possible the sysadmin has disabled icmp echo requests (I normally do).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 31 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.