-   Ubuntu (
-   -   I need to send email from PHP - How can I do this easily? (

wadesmart 06-30-2006 09:33 AM

I need to send email from PHP - How can I do this easily?
06302006 0829 GMT-6

This new thread was acting started as another one but, this more explains what is wrong.

Im working on fixing the local public schools messed up online system. A lot of the online apps need to be able to send mail. I havent wrote any code to send mail before - mainly because getting it all set up has always been a pain.

I want to have the ability to test the apps that I build on my computer so, I want to set this up. All my books say sendmail but I was told Ubuntu uses Postfix. I read some of the documentation and I just do not understand.

This is what I want to do. I want to send email to my own email account for testing. Is this possible?

Isnt there an easy way to do this?


cdhgee 06-30-2006 10:11 AM

Check out the mail function.

BTW, this should have been posted in the Programming forum, not the Ubuntu forum as this is not specific to Ubuntu.

wadesmart 06-30-2006 11:31 AM

Well, it is a programming question but its not the programming part that I need help with.

I know about the php mail function. I used it and nothing happened. After some searching I found in my mail log:

Jun 30 08:08:09 localhost postfix/smtp[26616]: 8E31018B41F: to=<>, relay=none, delay=215374, status=deferred (Host or domain name not found. Name service error for type=MX: Host not found, try again)

So, isnt this a mail question? If not - then Im sorry for the incorrectly posting in the wrong forum.

Its just getting some mail application to simply send some mail so I can get back to work.


cdhgee 06-30-2006 03:22 PM

Ah, I misinterpreted exactly what your problem was from what you said in your first post - apologies.

The error message suggests that Postfix can't find the MX records for (which do exist, I've just checked). Which either means that (a) your DNS isn't working correctly or (b) your network connection isn't working correctly.

Try running the following command manually from a terminal - do you get the following?


[david@malvern ~]$ nslookup -type=mx

Non-authoritative answer:  mail exchanger = 50  mail exchanger = 10

wadesmart 06-30-2006 08:06 PM

Well, there wouldnt be for I have that domain for my email only, and its hosted at Godaddy.

Stop. Lets start again.

My computer runs Ubuntu 5.10. I am working on some apps for the school and I have to be able to test the pages that send mail.

How can I do this from my system? I know that I have postfix on my system. I do not know how to set that up. Is there an easy way to do this?


wadesmart 06-30-2006 08:23 PM

Sorry, forgot to answer your question.

when I type nslook I get my current ip address for server and address. ** server cant find NOTIMP


cdhgee 07-06-2006 04:15 AM

Have you got postfix installed? If so, it should pretty much work out of the box.

Can you try using your PHP page to send an e-mail to a domain which will have ultra-reliable DNS such as or and see if that works? That will help us establish whether it's all DNS resolution that doesn't work, or just some domains, or something else entirely.

All times are GMT -5. The time now is 06:32 AM.