Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Kewun on Oct 07, 2016, 04:06 PM

Title: Sockets Email Problem Not Sent
Post by: Kewun on Oct 07, 2016, 04:06 PM
this is what i tried
function onScriptLoad()
{
g_Sender <- "[email protected]";
g_Rcver <- "[email protected]";
g_Subject <- "idk";
g_Message <- "works or not";

SendMail();
print("done")
}

function SendMail()
{
g_MailSocket <- NewSocket( "ProcessMail" );
g_MailSocket.SetNewConnFunc( "ConnEstablished" );
g_MailSocket.SetLostConnFunc( "CloseConnection" );
g_MailSocket.Connect( "-clip-", 25 );

g_Timer <- NewTimer( "CloseConnection", 2500, 1 );
}

function ConnEstablished()
{
g_MailSocket.Send( "HELO localhost\n" );
g_MailSocket.Send( "MAIL FROM: " + g_Sender + "\n" );
g_MailSocket.Send( "RCPT TO: " + g_Rcver + "\n" );
g_MailSocket.Send( "DATA\n" );
g_MailSocket.Send( "SUBJECT: " + g_Subject + "\n" );
g_MailSocket.Send( "\n" );
g_MailSocket.Send( g_Message + "\n" );
g_MailSocket.Send( ".\n" );
g_MailSocket.Send( "QUIT\n" );
}

function CloseConnection()
{
if ( g_MailSocket ) g_MailSocket.Delete();
g_Timer.Delete();
}


the email wasnt sent, i checked. but prints "done"
any help? i took those functions from digging in lu website

socket plugin is loaded!
Title: Re: Sockets Email Problem Not Sent
Post by: Anik on Oct 08, 2016, 09:49 AM
use "mail" function if using linux
Title: Re: Sockets Email Problem Not Sent
Post by: Kewun on Oct 08, 2016, 10:30 AM
im not using linux
Title: Re: Sockets Email Problem Not Sent
Post by: KAKAN on Oct 08, 2016, 12:30 PM
Where is the ProcessMail function? The socket might be searching for it, and might have not worked due to the lack of that function.
Title: Re: Sockets Email Problem Not Sent
Post by: Kewun on Oct 08, 2016, 12:40 PM
i think you mean ProcessMail function

i dont know where is it, i found this part of code so i trought it might work
Title: Re: Sockets Email Problem Not Sent
Post by: KAKAN on Oct 08, 2016, 03:42 PM
Try using IP address instead of domain name, it might do the trick.
Title: Re: Sockets Email Problem Not Sent
Post by: Kewun on Oct 08, 2016, 06:08 PM
k
Title: Re: Sockets Email Problem Not Sent
Post by: Thijn on Oct 09, 2016, 04:32 PM
Does that actually work using something like telnet?

e.g. Is your SMTP at fault or your script.
Title: Re: Sockets Email Problem Not Sent
Post by: KAKAN on Oct 10, 2016, 05:43 AM
Quote from: Thijn on Oct 09, 2016, 04:32 PMe.g. Is your SMTP at fault or your script.
Its simply Google blocking him for using a old kind of authentication method. I remember that there's an option in google's mail settings to enable it though :p
Title: Re: Sockets Email Problem Not Sent
Post by: Thijn on Oct 10, 2016, 05:57 AM
Quote from: KAKAN on Oct 10, 2016, 05:43 AM
Quote from: Thijn on Oct 09, 2016, 04:32 PMe.g. Is your SMTP at fault or your script.
Its simply Google blocking him for using a old kind of authentication method. I remember that there's an option in google's mail settings to enable it though :p
If he's indeed using the gmail smtp server that will never work because
1. You need to login
2. You need SSL

But we don't know that since he removed essential parts of his code.
Title: Re: Sockets Email Problem Not Sent
Post by: Kewun on Nov 21, 2016, 09:15 PM
i still dont know how to fix it
p.s im making this for lu :/
Title: Re: Sockets Email Problem Not Sent
Post by: KAKAN on Nov 22, 2016, 01:41 AM
Quote from: Arkhanths on Nov 21, 2016, 09:15 PMi still dont know how to fix it
p.s im making this for lu :/
You still haven't gave us what we need, incase we want it to debug.
Title: Re: Sockets Email Problem Not Sent
Post by: Xmair on Nov 22, 2016, 09:15 AM
This is VCMP's forum not LU's.
Title: Re: Sockets Email Problem Not Sent
Post by: Rhytz on Nov 22, 2016, 09:20 AM
I'd use a service like Mailgun if I wanted to send mail from my server
Title: Re: Sockets Email Problem Not Sent
Post by: Kewun on Nov 22, 2016, 09:27 AM
Quote from: KAKAN on Nov 22, 2016, 01:41 AM
Quote from: Arkhanths on Nov 21, 2016, 09:15 PMi still dont know how to fix it
p.s im making this for lu :/
You still haven't gave us what we need, incase we want it to debug.
Problem is when i use the code the email is  not sent
Title: Re: Sockets Email Problem Not Sent
Post by: KAKAN on Nov 22, 2016, 09:32 AM
Quote from: Arkhanths on Nov 22, 2016, 09:27 AM
Quote from: KAKAN on Nov 22, 2016, 01:41 AM
Quote from: Arkhanths on Nov 21, 2016, 09:15 PMi still dont know how to fix it
p.s im making this for lu :/
You still haven't gave us what we need, incase we want it to debug.
Problem is when i use the code the email is  not sent
Our problem is we don't have ProcessMail, the most required part of your code.

Quote from: Rhytz on Nov 22, 2016, 09:20 AMI'd use a service like Mailgun if I wanted to send mail from my server
I'd use Nodemailer (https://nodemailer.com/) and Google's free SMTP server (https://support.google.com/a/answer/176600?hl=en)( How To Use Google's SMTP Server (https://www.digitalocean.com/community/tutorials/how-to-use-google-s-smtp-server) by DigitalOcean (https://www.digitalocean.com/) ) instead.
Title: Re: Sockets Email Problem Not Sent
Post by: Rhytz on Nov 22, 2016, 09:34 AM
You need to atleast get rid of g_MailSocket.SetLostConnFunc( "CloseConnection" ); because SetNewConnFunc and SetLostConnFunc don't work together in LU. (http://mantis.liberty-unleashed.co.uk/view.php?id=137)

You should also create a function to check the response from the server.
Title: Re: Sockets Email Problem Not Sent
Post by: Kewun on Nov 22, 2016, 01:54 PM
Quote from: KAKAN on Nov 22, 2016, 09:32 AM
Quote from: Arkhanths on Nov 22, 2016, 09:27 AM
Quote from: KAKAN on Nov 22, 2016, 01:41 AM
Quote from: Arkhanths on Nov 21, 2016, 09:15 PMi still dont know how to fix it
p.s im making this for lu :/
You still haven't gave us what we need, incase we want it to debug.
Problem is when i use the code the email is  not sent
Our problem is we don't have ProcessMail, the most required part of your code.

Quote from: Rhytz on Nov 22, 2016, 09:20 AMI'd use a service like Mailgun if I wanted to send mail from my server
I'd use Nodemailer (https://nodemailer.com/) and Google's free SMTP server (https://support.google.com/a/answer/176600?hl=en)( How To Use Google's SMTP Server (https://www.digitalocean.com/community/tutorials/how-to-use-google-s-smtp-server) by DigitalOcean (https://www.digitalocean.com/) ) instead.

my problem is i dont have the ProcessMail function and i need some example script for sending email
Title: Re: Sockets Email Problem Not Sent
Post by: Rhytz on Nov 22, 2016, 05:41 PM
I think you're gonna have a hard time getting it to work like this either way... Most, if not all SMTP servers require authentication, and communicate using SSL/TLS nowadays, and thats tricky/impossible to work with using just the socket functions available in LU/VCMP.