SendMailTo: Difference between revisions
Jump to navigation
Jump to search
Justin Roth (talk | contribs) (Created page with "{{Useful Function}} __NOTOC__ Mit dieser Funktion kannst du eine E-Mail über ein PHP-Betriebenes Skript senden. Achtung: Für diese Funktion brauchst du die MTA SA SDK. Die f...") |
Justin Roth (talk | contribs) No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Useful Function}} | {{Useful Function}} | ||
<lowercasetitle/> | |||
__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 10: | ||
==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 31: | ||
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 43: | Line 43: | ||
==Example== | ==Example== | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
<syntaxhighlight lang="lua">function MailText ( player, cmd, ... ) | <syntaxhighlight lang="lua">function MailText ( player, cmd, headertext, ... ) | ||
local text = table.concat ( {...}, " " ) | local text = table.concat ( {...}, " " ) | ||
if text then | if text then | ||
sendMailTo ( "[email protected]", "[email protected]", text ) | sendMailTo ( "[email protected]", "[email protected]", headertext, text ) | ||
end | end | ||
Line 53: | Line 53: | ||
end | end | ||
addCommandHandler ( "sendmail", MailText )</syntaxhighlight></section> | addCommandHandler ( "sendmail", MailText )</syntaxhighlight></section> | ||
Author: SuperHomie(me) |
Latest revision as of 10:17, 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)