SendMailTo: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Useful Function}}
{{Useful Function}}
<lowercasetitle/>
__NOTOC__
__NOTOC__
Mit dieser Funktion kannst du eine E-Mail über ein PHP-Betriebenes Skript senden.
This function allows you to send a mail with a php system
Achtung: Für diese Funktion brauchst du die MTA SA SDK.
You must include the "MTASDK" in your PHP file. (https://wiki.multitheftauto.com/wiki/PHP_SDK)
Die findest du hier: https://wiki.multitheftauto.com/wiki/PHP_SDK




Line 10: Line 10:


==Required Arguments==
==Required Arguments==
*'''text:''' Der Text der anschließend in der E-Mail steht.
*'''text:''' The text of the e-mail is in the.


==Optional Arguments==
==Optional Arguments==
{{OptionalArg}}
{{OptionalArg}}
*'''mail:''' Hier wird der Empfaenger definiert.
*'''mail:''' Here, the recipient is defined.
*'''sender:''' Hier muss der Absender eingetragen werden, der die E-Mail gesendet hat.
*'''sender:''' Here, the sender must be entered that sent the e-mail.
*'''headertext:''' Hier muss der Betrefftext hin, der in der Betreffszeile er E-Mail steht.
*'''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:''' Ihr müsst eine send.php Datei erstellen, diese dann in UTF-8 umwandeln dann auf eurem FTP hochladen.  
'''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 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 [-]
Server
function 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)