Jump to content

[REL] Mail client 1.1


FatalTerror

Recommended Posts

111030055951976364.png

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.

111030054008679672.jpg

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.

111030054530392784.jpg

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

Thx, FatalTerror

Edited by Guest
Link to comment

Release 1.1

111031010408346124.jpg111031010505779987.jpg

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:

Link to comment
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.php

What's the php code off it?

This is the PHP SDK library of MTA. I've include it on the PHP files.

Where i can locate MTA sdk in MTA folder ?

Link to comment
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.php

What's the php code off it?

This is the PHP SDK library of MTA. I've include it on the PHP files.

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 :P

Link to comment
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; 
  
  

Link to comment
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 ?

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...