Jump to content

How to make mail() finction work?

- - - - -

  • Please log in to reply
2 replies to this topic

#1
thatsme

thatsme

    Programmer

  • Members
  • PipPipPipPip
  • 176 posts
Hi, i can't figure out, how to make mail function work. It just does not send any letters. All parfemeters passed to function are initialized. My code is here:
    $sql = "SELECT * FROM NewsletterSubscribers";
    $result = mysql_query($sql, $con);
    while ($row = mysql_fetch_array($result)){
        $to = $row['Email'];
        mail($to, $emailName, $letter);
    }
I would be grateful for any help

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
If you are on unable to send mail, then you will need to verify you have a mail transport agent set up with PHP and that it is functioning, with a mail server you can connect to.

If you are on a shared hosting provider, it is likely an issue with them and you will need to contact them through support. If you are on a virtual server or on a local machine you will need to download an MTA yourself, such as sendmail, and set this up to speak to a mail server. You can relay mail through your ISP mail server, or gmail for example.

More context would be helpful on your situation.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
so1i

so1i

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 312 posts
Have you checked the mail() function, taken out of the context you have put it in? Try putting in actual values, rather than values returned from your database. If it works then, you know the errors is somewhere else. If it doesn't, you know it might be a problem as Alexander outlined above.
My Company - My Homepage - My Twitter - My Google+ - My LinkedIn

"Things don’t have to change the world to be important.” - Steve Jobs




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users