MyBB Community Forums

Full Version: Send email with a plugin?!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
OK guys, I've searched the forums and documentation and racked my brains for hours, and I cannot for the LIFE of me figure out how to get my plugin to send and email! Everything works smoothly right up until the send mail part, and then NO MAIL SENDS!!

I've tried my_mail() and just mail(), and they don't work. Is there something I'm missing? Is there documentation hidden somewhere for this?

Please help, or I will go crazy. (I promise.)
send mail function is;

my_mail($subject , $message)
(2010-07-31, 07:07 PM)ghazal Wrote: [ -> ]send mail function is;

my_mail($subject , $message)


Now who would that send the email to?
Santa claus Big Grin
(2010-07-31, 10:11 PM)dunlop03 Wrote: [ -> ]Santa claus Big Grin

Ignore that. >_>

If i am reading this right (Which i very well may not being) that send it to the user of the page or post it is located in.
Alright, seems as though my hosting company pulled a fast one, and PHP mail just doesn't work on their sever. So... my code is probably good, but there's still some mystery for me about that my_mail() function. Is there documentation for that somewhere, or is it a secret function?
Its not the secret function !

As I said, you can use it to send emails from your plugin.

For example,

		my_mail("".$mybb->settings['email_sent_to']."", "
			".$mybb->settings['email_subject']."\"", "
			".$mybb->settings['email_message']."
");

This will send Email containing Email Subject + Email Message to the email in "$mybb->settings['email_sent_to']" setting.

Edit: May be this will help you a litle: http://community.mybb.com/archive/index....24978.html
Where's the MyBB documentation page for this function? It would be helpful to see some official documentation.
inc/functions.php::my_mail()

/**
 * Sends an email using PHP's mail function, formatting it appropriately.
 *
 * @param string Address the email should be addressed to.
 * @param string The subject of the email being sent.
 * @param string The message being sent.
 * @param string The from address of the email, if blank, the board name will be used.
 * @param string The chracter set being used to send this email.
 * @param boolean Do we wish to keep the connection to the mail server alive to send more than one message (SMTP only)
 * @param string The format of the email to be sent (text or html). text is default
 * @param string The text message of the email if being sent in html format, for email clients that don't support html
 * @param string The email address to return to. Defaults to admin return email address.
 */
function my_mail($to, $subject, $message, $from="", $charset="", $headers="", $keep_alive=false, $format="text", $message_text="", $return_email="")