FatalTerror Posted October 30, 2011 Posted October 30, 2011 (edited) Mail Client Hi everybody, Today i've make one client mail. This script send mail for email with the function PHP mail() How this work? On the server: You write /mail and a Gui start. You type the mail adress and the subject of the mail. You write your message and press in Send The script will take all informations and send on the website via callRemote() On the website: The website will take informations and send everything via mail() function. If the message are successfully sended, this return true. On hotmail: Hotmail have successfully receive the message and he show it. Code PHP File: <?php include( "mta_sdk.php" ); $input = mta::getInput(); $player = $input[0]; $target = $input[1]; $subject = $input[2]; $message = $input[3]; $mail = $target; // Déclaration de l'adresse de destination. if (!preg_match("#^[a-z0-9._-]+@(hotmail|live|msn).[a-z]{2,4}$#", $mail)) // On filtre les serveurs qui rencontrent des bogues. { $passage_ligne = "\r\n"; } else { $passage_ligne = "\n"; } //=====Déclaration des messages au format texte et au format HTML. $message_txt = " "; $message_html = "<html> <body> <center><img src=\"https://community.multitheftauto.com/images/gallery/twitter/5145.png\" /></center><br /> ".$message."<br /> <br /> <br /> <b>© AMG Team</b> This message has been sended by Client Mail script<br /> </body> </html>"; //========== //=====Création de la boundary $boundary = "-----=".md5(rand()); //========== //=====Définition du sujet. $sujet = "MTA Team - ".$subject.""; //========= //=====Création du header de l'e-mail. $header = "From: \"MTA Team\"<[email protected]>".$passage_ligne; $header.= "Reply-to: \"MTA Team\" <[email protected]>".$passage_ligne; $header.= "MIME-Version: 1.0".$passage_ligne; $header.= "Content-Type: multipart/alternative;".$passage_ligne." boundary=\"$boundary\"".$passage_ligne; //========== //=====Création du message. $message = $passage_ligne."--".$boundary.$passage_ligne; $message.= $passage_ligne."--".$boundary.$passage_ligne; //=====Ajout du message au format HTML $message.= "Content-Type: text/html; charset=\"ISO-8859-1\"".$passage_ligne; $message.= "Content-Transfer-Encoding: 8bit".$passage_ligne; $message.= $passage_ligne.$message_html.$passage_ligne; //========== $message.= $passage_ligne."--".$boundary."--".$passage_ligne; $message.= $passage_ligne."--".$boundary."--".$passage_ligne; //========== //=====Envoi de l'e-mail. mail($mail,$sujet,$message,$header); //========== $theresult = true; mta::doReturn($theresult, $player); ?> Server side: function mail_return(result, player) if result == true then outputChatBox("#ABCDEF* You mail are successfully sended !", player, 255, 255, 255, true) else outputChatBox("Sorry, but we can't send your mail. Reasons: Internal error or PHP error.", player, 255, 255, 255, true) end end addEvent("sendMessage", true) addEventHandler("sendMessage", getRootElement(), function(player, mail_target, mail_subject, mail_message) callRemote ( "http://www.watzuku.com/MTA/mail.php", mail_return, player, mail_target, mail_subject, mail_message ) end) Client side: window = guiCreateWindow(129,189,484,378,"AMG | Client Mail | by FatalTerror",false) target = guiCreateEdit(9,63,236,32,"",false, window) target_lbl = guiCreateLabel(11,40,237,20,"Destination:",false,window) subject = guiCreateEdit(251,63,224,32,"",false,window) send = guiCreateButton(392,24,83,32,"Send mail",false,window) message = guiCreateMemo(9,99,466,270,"",false,window) subject_lbl = guiCreateLabel(254,40,209,20,"Subject:",false,window) close = guiCreateButton(9,23,50,20,"Close",false,window) guiSetVisible(window, false) addCommandHandler("mail", function() guiSetVisible(window, true) showCursor(true) guiSetInputEnabled ( true) end) addEventHandler("onClientGUIClick", getRootElement(), function() if (source == send)then local mail_subject = guiGetText(subject) local mail_message = guiGetText(message) local mail_target = guiGetText(target) local player = getLocalPlayer() triggerServerEvent("sendMessage", getLocalPlayer(), player, mail_target, mail_subject, mail_message) elseif (source == close)then guiSetVisible(window, false) showCursor(false) guiSetInputEnabled ( false) end end) Download Script for server: https://community.multitheftauto.com/index.php?p=resources&s=details&id=3120 Files for website:Download link Thx, FatalTerror Edited November 1, 2011 by Guest
FatalTerror Posted October 30, 2011 Author Posted October 30, 2011 Really nice work, keep up the good work! Thanks, now Castillo you can make again your Computer system with a real mail client
Castillo Posted October 30, 2011 Posted October 30, 2011 That's a cool idea, I was thinking that I should re-script it as I'am more experienced than before. Edit: Would be possible to get email's? just a suggestion.
NotAvailable Posted October 30, 2011 Posted October 30, 2011 This could be used as an email bomber. You should add a anti-spam feature. Anyways, good job!
FatalTerror Posted October 30, 2011 Author Posted October 30, 2011 Anti-spam o_O? I can add a Captcha... but not more ^^ @Castillo: It's possible but you must have the username & password of the account. This is not very secure...
NotAvailable Posted October 30, 2011 Posted October 30, 2011 Anti-spam o_O?I can add a Captcha... but not more ^^ @Castillo: It's possible but you must have the username & password of the account. This is not very secure... Use a timer, captcha is a good idea to.
FatalTerror Posted October 31, 2011 Author Posted October 31, 2011 Release 1.1 Modifications Simple Captcha added Menu for visual items New style I don't know if the captcha is sufficient... function generateCaptcha() local letters = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"} local letter1 = math.random(1, #letters) local letter2 = math.random(1, #letters) local letter3 = math.random(1, #letters) local number1 = math.random(1, 9) local code = ""..letters[letter1]..letters[letter3]..letters[letter2]..letters[number1].."" guiSetText(lbl_captcha, "Captcha ("..code.."):") return code end I've added function to add special effects in your email. Exemple: add your text in bold, use the html balises addEventHandler("onClientGUIClick", getRootElement(), function() if (source == mnu_bold)then local mail_message = guiGetText(message) local thecode = "".." ".."" guiSetText(message, ""..mail_message.." "..thecode.."") elseif (source == mnu_italic)then local mail_message = guiGetText(message) local thecode = "".." ".."" guiSetText(message, ""..mail_message.." "..thecode.."") elseif (source == mnu_under)then local mail_message = guiGetText(message) local thecode = "".." ".."" guiSetText(message, ""..mail_message.." "..thecode.."") elseif (source == mnu_url)then local mail_message = guiGetText(message) local thecode = "\"LINK\">".." ".."" guiSetText(message, ""..mail_message.." "..thecode.."") elseif (source == mnu_img)then local mail_message = guiGetText(message) local thecode = "\"LINK\"/>" guiSetText(message, ""..mail_message.." "..thecode.."") elseif (source == mnu_break)then local mail_message = guiGetText(message) local thecode = " " guiSetText(message, ""..mail_message.." "..thecode.."") end end) Download: https://community.multitheftauto.com/index.php?p=resources&s=details&id=3120
FatalTerror Posted October 31, 2011 Author Posted October 31, 2011 Thanks, I hope that other scripters will do great things with this !
karlis Posted October 31, 2011 Posted October 31, 2011 captcha isnt doing anything, guiGetText() returns it.use some images, or streamed sound file.
FatalTerror Posted November 1, 2011 Author Posted November 1, 2011 captcha isnt doing anything, guiGetText() returns it.use some images, or streamed sound file. I will add it on the future release. Bug detected: XSS Error, this can be fatal for the website... Don't try HTML balises are incorrectly added in the input
denny199 Posted November 1, 2011 Posted November 1, 2011 Hey, can you send the new php code?, caus if got edited [ only the image and upload on my own web] then it gaves an error help?
FatalTerror Posted November 1, 2011 Author Posted November 1, 2011 Hey, can you send the new php code?, caus if got edited [ only the image and upload on my own web] then it gaves an error help? For the 1.1 i've make any changes, you can download the PHP files here: Download link MTA_SDK.phpWhat's the php code off it? This is the PHP SDK library of MTA. I've include it on the PHP files. Community page
CapY Posted November 2, 2011 Posted November 2, 2011 Hey, can you send the new php code?, caus if got edited [ only the image and upload on my own web] then it gaves an error help? For the 1.1 i've make any changes, you can download the PHP files here: Download link MTA_SDK.phpWhat's the php code off it? This is the PHP SDK library of MTA. I've include it on the PHP files. Community page Where i can locate MTA sdk in MTA folder ?
denny199 Posted November 3, 2011 Posted November 3, 2011 Hey, can you send the new php code?, caus if got edited [ only the image and upload on my own web] then it gaves an error help? For the 1.1 i've make any changes, you can download the PHP files here: Download link MTA_SDK.phpWhat's the php code off it? This is the PHP SDK library of MTA. I've include it on the PHP files. Community page Where i can locate MTA sdk in MTA folder ? Well mayby u hosting with 000webhost then u can uplaod it to the ftp then your'e website in: public_html you need make a new map like mail or something Then in that's map upload the mail.php and the MTA_SDK.php then u go to the script server side then put your'e website link there like this: callRemote ( "http://www.yourwebsite.com.com/mail/mail.php", mail_return, player, mail_target, mail_subject, mail_message ) -- sorry for the ehm, fucked up english, I'ts 6:50 now
CapY Posted November 3, 2011 Posted November 3, 2011 who is the sender? The user from the server and deliver is specified site.
FatalTerror Posted November 3, 2011 Author Posted November 3, 2011 who is the sender? The user from the server and deliver is specified site. Hm no... The sender is the website and the deliver is the IMAP protocol (hotmail, yahoo, gmail ...) The server send only informations for the website (subject, message...) If you website accept the function mail(), the sender will be "[email protected]". You can change this informations in mail.php $header = "From: \"MTA Team\"<[email protected]>".$passage_ligne; $header.= "Reply-to: \"MTA Team\" <[email protected]>".$passage_ligne; $header.= "MIME-Version: 1.0".$passage_ligne; $header.= "Content-Type: multipart/alternative;".$passage_ligne." boundary=\"$boundary\"".$passage_ligne;
CapY Posted November 3, 2011 Posted November 3, 2011 who is the sender? The user from the server and deliver is specified site. Hm no... The sender is the website and the deliver is the IMAP protocol (hotmail, yahoo, gmail ...) The server send only informations for the website (subject, message...) If you website accept the function mail(), the sender will be "[email protected]". You can change this informations in mail.php $header = "From: \"MTA Team\"<[email protected]>".$passage_ligne; $header.= "Reply-to: \"MTA Team\" <[email protected]>".$passage_ligne; $header.= "MIME-Version: 1.0".$passage_ligne; $header.= "Content-Type: multipart/alternative;".$passage_ligne." boundary=\"$boundary\"".$passage_ligne; Any plans for the future ?
FatalTerror Posted November 3, 2011 Author Posted November 3, 2011 What do you mean with "plans"? I've ideas for future Mail client and more ideas for new scripts ...
CapY Posted November 3, 2011 Posted November 3, 2011 What do you mean with "plans"? I mean on updates(upgrades) I've ideas for future Mail client and more ideas for new scripts ... That scripts will use callRemote too ?
MTA Team qaisjp Posted November 3, 2011 MTA Team Posted November 3, 2011 well then cant you send fake emails, for example "[email protected]"
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now