Page 1 of 1

Sending Mail from an Internal LAN - Any Advice? [Solved]

PostPosted: 11. July 2012 09:43
by tweezer
Hello,

I am running XAMPP 1.7.4 on a Windows 7 machine on an INTERNAL LAN. We use it in our office to run PHP/MySQL applications without any access to it opened to the outside world.

But, I would like certain applications to be able to send emails to my staff, such as joe@mycompany.com. We use google apps (gmail) as our mail service provider (that is, mycompany.com is actually gmail).

I've read a lot of different posts, but wondering if someone can give me a nudge in the right direction to get my php applications on my LAN sending emails to my staff at mycompany.com.

Any advice is greatly appreciated!
Cheers,
T.

Re: Sending Mail from an Internal LAN - Any Advice?

PostPosted: 11. July 2012 11:00
by JonB
You need to use the 'fake sendmail' included with XAMPP. Its found in the xampp\sendmail folder. There's a configuration file for it with (as Irecall) examples in it. If you want tutorials Google 'setup fake semdmail'. (and, of course add the right PHP code) :D

As long as you have an internet connection, it will be able to use Google's SMTP servers to forward your mail.

Good Luck
8)

Re: Sending Mail from an Internal LAN - Any Advice?

PostPosted: 11. July 2012 11:19
by tweezer
Thanks Jon! I have read a bit about this setup. I'll head down that road and let you know how it goes.

Cheers!
T.

SOLVED: Sending Mail from an Internal LAN - Any Advice

PostPosted: 11. July 2012 13:56
by tweezer
Thanks for your advice Jon. It works now.

I looked at some other stuff out there on this topic, and did the below steps with my setup. Note that I use google apps as my email service provider. That is, email to user@mydomain.com goes to gmail and is handled there.

Edited the php.ini file as follows:

Under the [mail function] area:
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 587

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from =username@mydomain.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

The I edited the sendmail.ini file as follows:

smtp_server=smtp.gmail.com

smtp_port=587

default_domain=mydomain.com

auth_username=username@mydomain.com
auth_password=xxxxxxxx

force_sender=username@mydomain.com

hostname=mydomain.com

STOPPED AND RESTARTED APACHE!!!

Then I used the test php script I found here: http://www.daniweb.com/web-development/php/threads/347696/sending-email-from-localhost-in-xampp-windows

And it worked! :D

It also works for my applications.

Thanks again,
T

Re: Sending Mail from an Internal LAN - Any Advice? [Solved]

PostPosted: 11. July 2012 14:25
by JonB
Great - I'm glad its working. and thanks for posting how you got things working.

LOL - I use it for the "Excruciatingly Correct Guide" 's XAMPP server (found in my 'sig' line), so I was pretty sure you would get it working.

Good Luck with XAMPP
8)

Re: Sending Mail from an Internal LAN - Any Advice? [Solved]

PostPosted: 11. July 2012 15:04
by tweezer
Excruciatingly excellent!

One footnote:

I found that I do not necessarily need this in sendmail.ini:

force_sender=username@mydomain.com

You can leave that commented out and the emails have the correct sender address when coming from the application...

Cool stuff!!

T.