SendMailTo: Difference between revisions
Jump to navigation
Jump to search
Justin Roth (talk | contribs) No edit summary |
Justin Roth (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
{{Useful Function}} | {{Useful Function}} | ||
__NOTOC__ | __NOTOC__ | ||
This function allows you to send a mail with a php system | |||
You must include the "MTASDK" in your PHP file. (https://wiki.multitheftauto.com/wiki/PHP_SDK) | |||
Line 10: | Line 9: | ||
==Required Arguments== | ==Required Arguments== | ||
*'''text:''' | *'''text:''' The text of the e-mail is in the. | ||
==Optional Arguments== | ==Optional Arguments== | ||
{{OptionalArg}} | {{OptionalArg}} | ||
*'''mail:''' | *'''mail:''' Here, the recipient is defined. | ||
*'''sender:''' | *'''sender:''' Here, the sender must be entered that sent the e-mail. | ||
*'''headertext:''' | *'''headertext:''' Here the subject text needs to go, which it is e-mail in the subject line. | ||
==Code== | ==Code== | ||
Line 31: | Line 30: | ||
end</syntaxhighlight> | end</syntaxhighlight> | ||
'''PHP:''' | '''PHP:''' You must create a send.php file, then then convert to UTF-8 on your FTP upload. | ||
<syntaxhighlight lang="lua">[php] | <syntaxhighlight lang="lua">[php] | ||
<?php | <?php | ||
Line 53: | Line 52: | ||
end | end | ||
addCommandHandler ( "sendmail", MailText )</syntaxhighlight></section> | addCommandHandler ( "sendmail", MailText )</syntaxhighlight></section> | ||
Author: SuperHomie(me) |
Revision as of 09:54, 20 July 2014
This function allows you to send a mail with a php system
You must include the "MTASDK" in your PHP file. (https://wiki.multitheftauto.com/wiki/PHP_SDK)
Syntax
string sendMailTo( string mail, string sender, string headertext, string text)
Required Arguments
- text: The text of the e-mail is in the.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- mail: Here, the recipient is defined.
- sender: Here, the sender must be entered that sent the e-mail.
- headertext: Here the subject text needs to go, which it is e-mail in the subject line.
Code
function sendMailTo ( mail, sender, headertext, text ) callRemote ( "http://www.example.com/send.php", EMailAccepted, mail, sender, headertext, text ) end function EMailAccepted () outputDebugString ( "E-Mail was succesfully sended." ) end
PHP: You must create a send.php file, then then convert to UTF-8 on your FTP upload.
[php] <?php include ( "mta_sdk.php" ); $input = mta::getInput(); mail($input[0], $input[2], $input[3], "From: ".$input[1]."\n" . "Content-Type: text/html; charset=iso-8859-1\n"); ?>
Example
Click to collapse [-]
Serverfunction MailText ( player, cmd, headertext, ... ) local text = table.concat ( {...}, " " ) if text then sendMailTo ( "[email protected]", "[email protected]", headertext, text ) end end addCommandHandler ( "sendmail", MailText )
Author: SuperHomie(me)