Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

sendmail with PHP on windows.

  • 04-02-2009 8:10am
    #1
    Registered Users, Registered Users 2 Posts: 2,236 ✭✭✭


    Hi,

    I'm having some trouble send e-mails with php. I have come to the conclusion that I need some kind of smtp server.

    I have installed SMTP Relay Server

    I'm really confused with all this as I know very little about domains and dns.

    I think this program acts as a server that php connects to. It then send e-mail using a mail server that you provide. I've tried gmails server but this doesn't work due to SSL or something.

    Has anybody achieved what I am trying to do on a windows machine? I'm using WAMPServer..

    Thanks..


Comments

  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    Yeah, it can be tricky. What version of windows are you using?

    There are a couple of options.
    Firstly, the free one is to use IIS. If you're using Windows Server or XP Pro, you can install IIS's SMTP component which will give you an SMTP server on the localhost. You don't have to use the web server component of IIS so you can continue using Apache.

    Within the SMTP server of IIS you can configure an upstream host for your server. What this does is instead of trying to send the mail to each recipient directly, it sends all of its email to another SMTP server (usually your ISPs), which handles it from there. This is the best option in my experience for development machines - very little to go wrong.

    If this is a production web server, then put in your company's SMTP server address (which may very well be your ISP's) as your SMTP host and it will send the mail for you.

    If you're willing to pay for it, there's a sendmail program for windows:
    http://www.indigostar.com/sendmail.htm

    We used this for years on an SAP installation and it worked fine.


  • Registered Users, Registered Users 2 Posts: 6,571 ✭✭✭daymobrew


    I've used fake sendmail. I use it with XAMPP on XP. It connects to my host's SMTP server.


  • Registered Users, Registered Users 2 Posts: 2,236 ✭✭✭techguy


    Thanks guys..

    I think I saw these sendmail programs around, I might try to use fake sendmail.

    How do you mean it connects to your hosts SMTP server. What do you mean by host..your companys exchange server or ISP.

    I'm having trouble finding an SMTP server that will accept unsecured connections. Google and Yahoo use SSL.

    @Seamus, How do I go about setting up that SMTP server, my server is server 2k3 and my dev machine is XP Pro. To use this server do I need to set up a domain? That it something that i've not gotten around to yet, dns either..it boggles me:o

    Thanks..


  • Registered Users, Registered Users 2 Posts: 6,571 ✭✭✭daymobrew


    techguy wrote: »
    How do you mean it connects to your hosts SMTP server. What do you mean by host..your companys exchange server or ISP.
    Fake sendmail is run on my home XP box. It points to my web site hosting provider (not my ISP or a company server).

    For the 'From' address, I put that address and the email account's password in the sendmail.ini file. I think that fake sendmail authenticates the address and password before sending the mail. This is probably a security requirement of my web site hosting provider.


  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    Don't worry about DNS or domains, you're only adding confusion to it. Your SMTP server will use the DNS settings of the main network connection.

    To install IIS or any of its components, in both 2k3 and XPP, you go to Control Panel > Add/Remove Programs > Add/Remove Windows Components. In there you should see "Internet Information Services" (or maybe just plain old IIS), and if you drill-down into that, you can see all of the various components - WWW Publishing, FTP server, SMTP Server and so forth. Just install the SMTP Server component.
    How do you mean it connects to your hosts SMTP server. What do you mean by host..your companys exchange server or ISP.
    If you're doing this kind of off your own bat, then you'll have an isp. That ISP will have an SMTP server which should be used for sending all of your mail. NTL's for example, is smtp.upcmail.ie. It doesn't matter what address you're sending from. If you're sending from joe.bloogs@gmail.com, you'll still use your ISP's mail server.

    If this is a business with its own internal email server, then chances are you won't be able to connect to your ISPs mail server. In that case, you just use your company's internal mail server and it sends the mail for you.

    In both cases, you don't actually need to set up an SMTP server on your machine - you simply put in the address of your ISPs/Companys server into the php.ini file. I only set up a local SMTP server on the dev machine because it makes that machine portable, and it makes it simple to "switch off" sending email when testing.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,236 ✭✭✭techguy


    Great but my main problem is finding a mail server I can use..

    I use BT but don't have an e-mail address from them, can I egt one from their site and just use their server??


  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    If BT are your ISP, then use mail.iol.ie as your SMTP server. Port 25.


  • Registered Users, Registered Users 2 Posts: 2,236 ✭✭✭techguy


    seamus wrote: »
    If BT are your ISP, then use mail.iol.ie as your SMTP server. Port 25.

    Thanks,

    I'm just on their site now.. It seems those servers only work if you are sending from a bt connection..

    My dev connection is O2 mobile broadband, I'm going to go check what mail services they..

    Thanks for holding my hands guys, I feel like an annoyance now..

    I know what to do now so i'll just figure the rest out and stop annoying;)

    Thanks again!!


  • Registered Users, Registered Users 2 Posts: 2,236 ✭✭✭techguy


    Ok, once again, i'm back..sorry!

    I got the SMTP Relay setup on my BT(iol)machine and sending mail. Below is a snippet from the log file:
    {05/Feb/2009 16:19:18} [2192] [Info] Sending message C:\FkeySMTP\Queue\00002.msg to my_address@yahoo.co.uk through relay number 1 out of 2. IP is 217.12.11.64:25
    {05/Feb/2009 16:19:18} [2192] [Debug] We are connected to 217.12.11.64:25 on port 1655
    {05/Feb/2009 16:19:18} [2192] [Debug] 217.12.11.64:25|1655 <- 553 Mail from 78.16.37.32 not allowed - [80]
    {05/Feb/2009 16:19:18} [2192] [Debug] 217.12.11.64:25|1655 -> QUIT
    {05/Feb/2009 16:19:18} [2192] [Debug] We are disconnected from 217.12.11.64:25. Port: 1655
    {05/Feb/2009 16:19:18} [2192] [Error] Message C:\FkeySMTP\Queue\00002.msg to my_address@yahoo.co.uk failed this time with error Mail from 78.16.37.32 not allowed - [80]. Attempts set to 2, priority to 0 rescheduled at regular queue
    
    

    It looks to me like the yahoo server wont take e-mails from my bt IP address. I got this error before when trying to send to gmail. Google said something about addresses and domains not matching so it was denied..Can't find the link now though.

    Does anybody know anything about this?


    EDIT:

    I am having success sending emails to *@gmail.com and *@iolfree.ie

    I am having problems sending e-mails to *@iol.ie and *@yahoo.co.uk

    Does anybody feel my pain right now??


  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    Your problem is that your machine is trying to send the email directly to yahoo's servers, and it's being rejected (rightly so).

    Are you using one of the sendmail things above? You shouldn't have any log files if you've told PHP to send using IOL's (or O2's) mail server.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,236 ✭✭✭techguy


    I'm using a program called SMTP Realy server that acts a mail server on my machine and then relays mail to IOL's server for sending..

    I think the above is along the right lines because I can send e-mails to gmail and iolfree addresses...you say yahoo is rejecting becuase I am sending directly to their server ho do I do it properly?


    How do I tell php to send mail using mail.iolfree.ie?? Is that in the mail section in PHP.ini ?
    I've tried that and it doesn't work..
    If BT are your ISP, then use mail.iol.ie as your SMTP server. Port 25.

    Where should I put this info? I also need to authenticate.

    Sorry if that reply was scattered im just really stressed right now..


  • Registered Users, Registered Users 2 Posts: 68,317 ✭✭✭✭seamus


    techguy wrote: »
    I'm using a program called SMTP Realy server that acts a mail server on my machine and then relays mail to IOL's server for sending..
    Well, if it works then it might just not be configured correctly. You need to tell it to send all mail through IOL's mail server and to not attempt to send it directly to the address.


  • Registered Users, Registered Users 2 Posts: 2,236 ✭✭✭techguy


    Thats true,there's some setting there that i'm not sure about and I think its to do with that..

    I'll have a look later and see if I can resolve it..thanks!


Advertisement