SRL Archive - OSR Help

Notifications


Death12652

2010-05-16 12:31:58

Is there a way for scar to email or something of that nature to the owner if something were to go wrong with a script? Like if it doesn't find a color or something?

Frement

2010-05-16 12:35:52

From: death12652
Is there a way for scar to email or something of that nature to the owner if something were to go wrong with a script? Like if it doesn't find a color or something?


Yes, by using a HTTPPostaPage or similar, using PHP on your website to send the mail.

Death12652

2010-05-16 13:15:51

So how would I do that?!?!?!

Awkwardsaw

2010-05-16 13:18:52

trilez has a tut in the member section, ask him to share :)

Frement

2010-05-16 13:54:52

Heres SCAR code:
function MailError(Error, Text: String): String;
var Page: Integer;
begin
Page := InitializeHTTPClient(False, False);
ClearPostData(Page);
AddPostVariable(Page, 'error', Error);
AddPostVariable(Page, 'text', Text);
Result := PostHTTPPageEx(Page, 'http://www.domain.com/mail.php');
FreeHTTPClient(Page);
end;
and heres the PHP code:
[PHP]<?php

$mail = "yourmail@domain.com";
$subject = "ERROR: " . $_POST["error"];
$message = $_POST["text"];

if (strlen($mail) > 1 && strlen($subject) > 7 && strlen($message) > 1) {
mail($mail, $subjet, $message);
echo "Success!";
} else {
echo "Failed!";
}


?>[/PHP]

Death12652

2010-05-16 13:55:12

Frement Where do I post the php code? In MySQL.

Gu3st...

2010-05-16 17:05:20

From: Frement
Heres SCAR code:
function MailError(Error, Text: String): String;
begin
Page := InitializeHTTPClient(False, False);
ClearPostData(Page);
AddPostVariable(Page, 'error', Error);
AddPostVariable(Page, 'text', Text);
Result := PostHTTPPageEx(Page, 'http://www.domain.com/mail.php');
end;
and heres the PHP code:
[PHP]<?php

$mail = "yourmail@domain.com";
$subject = "ERROR: " . $_POST["error"];
$message = $_POST["text"];

if (strlen($mail) > 1 && strlen($subject) > 7 && strlen($message) > 1) {
mail($mail, $subjet, $message);
echo "Success!";
} else {
echo "Failed!";
}


?>[/PHP]


Don't forget to free the HTTPClient! ;)
Also, Page doesn't exist in that function..

Frement

2010-05-16 17:06:01

From: Zyt3x
Don't forget to free the HTTPClient! ;)
Also, Page doesn't exist in that function..


Yeah sorry about those, i almost exactly copied it from my script :P

From: death12652
Frement Where do I post the php code? In MySQL.


Just make it a PHP file named mail.php

Then modify the scar function to send it to yoursite.com/mail.php and edit the php file to contain your email address.

Death12652

2010-05-16 19:47:59

So I did what you said and I get this…


[Runtime Error] : Exception: Access violation at address 0077D26D in module 'scar.exe'. Read of address 00000000 in line 5 in script

Sex

2010-05-16 20:34:30

Show exactly what you have in your SCAR window.

Death12652

2010-05-16 20:53:17

Here…


program New;
function MailError(Error, Text: String): String;
begin
Page := InitializeHTTPClient(False, False);
ClearPostData(Page);
AddPostVariable(Page, 'error', Error);
AddPostVariable(Page, 'text', Text);
Result := PostHTTPPageEx(Page, 'http://www.domain.com/mail.php');
end;
begin
FreeHTTPClient(Page);
MailError('Error', 'Video Out Of Date');
end.

Or am I doing it wrong?

i luffs yeww

2010-05-16 20:54:16

Well first of all, that shouldn't compile. :p

Sex

2010-05-16 20:56:11

program New;

function MailError(Error, Text: String): String;
var
Client : integer;
begin
Client := InitializeHTTPClient(False, False);
AddPostVariable(Client, 'error', Error);
AddPostVariable(Client, 'text', Text);
Result := PostHTTPPageEx(Client, 'http://www.domain.com/mail.php');
FreeHTTPClient(Client);
end;

begin
MailError('Error', 'Video Out Of Date');
end.

Death12652

2010-05-16 21:23:10

Okay It executes and stuff so will it email me the 'Error' and 'video out of date' part or what. Also I want it to email what video. The videos are in a seperate scar file set up as arrays. It chooses a website randomly and goes to it. I want it to send me an email if the video is out of date? I used an OpenWebPage() Function. Thanks.

Frement

2010-05-16 23:29:59

From: death12652
Okay It executes and stuff so will it email me the 'Error' and 'video out of date' part or what. Also I want it to email what video. The videos are in a seperate scar file set up as arrays. It chooses a website randomly and goes to it. I want it to send me an email if the video is out of date? I used an OpenWebPage() Function. Thanks.


Well you have to make some detection if the video is outdated, then just add it to to text.

Death12652

2010-05-18 17:59:08

I did what you said but it doesn't send the email. It says successfully compiled but doesn't send the email?

Frement

2010-05-18 18:06:10

From: death12652
I did what you said but it doesn't send the email. It says successfully compiled but doesn't send the email?


And you have the PHP done right? Make it writeln the return from the site :)

Illkillutill

2010-05-18 22:35:53

if you don't even want to mess with the php, use smtp…

for example, this will send me a txt message. it works, i just made sure…

program smtpEmail;

Procedure WaitForResponse(c : Integer);
var s : String;
begin
repeat
if (ReadConnectionData(c, s)) then
begin
Wait(50);
end else
begin
Writeln('Connection error');
Exit;
end;
until (s<>'') or (not IsConnectionOpen(c));
end;

Procedure SendEmail(smtpserver, frommail, tomail, subject, data : String);
var c : Integer;
begin
c := OpenConnection(smtpserver, 25, 1000);
WaitForResponse(c);
SendConnectionData(c, 'HELO me' + #13#10);
WaitForResponse(c);
SendConnectionData(c, 'MAIL FROM: ' + frommail + #13#10);
WaitForResponse(c);
SendConnectionData(c, 'RCPT TO: <' + tomail + '>' + #13#10);
WaitForResponse(c);
SendConnectionData(c, 'DATA' + #13#10);
WaitForResponse(c);
SendConnectionData(c, 'Subject: ' + subject + #13#10#13#10);
SendConnectionData(c, data + #13#10);
SendConnectionData(c, '.' + #13#10);
WaitForResponse(c);
end;

begin
SendEmail('smtp.windstream.net', 'illkillutill@live.com', 'MyPhoneNumber@vtext.com', 'hi', 'hola');
end.


Just change "smtp.windstream.net" from the example to whatever your service provider is, like "smtp.yourisp.whatever". Then change "illkillutill@live.com" to your email address, and "MyPhoneNumber" to your number or your email address and it should email you whatever is in the "hi" and "hola" params. Edit: So change "hi" to "Error" and "hola" to "text".

Death12652

2010-05-18 23:41:15

I have this…


begin
SendEmail('smtp.live.com', '*********@live.com', '*********@live.com', 'hi', 'hola');
end.

but nothing in my inbox? plus I tried port 25 and 587.

Illkillutill

2010-05-18 23:45:15

erm… i dont think your isp is live.com? :p

who is your internet service provider? [i.e] comcast, windstream, etc…

try fixing that and see what comes up


Edit: so if it were comcast, make it ('smtp.comcast.net'…)

Death12652

2010-05-19 00:33:52

Thanks you!!! it works now!!!

Illkillutill

2010-05-19 10:58:12

Glad i could help :)

Death12652

2010-05-19 15:47:05

Will it work for everyone. I have Comcast by the way. If I send it to them to they need to change that part to there provider or does it just have to be mine?

i luffs yeww

2010-05-19 16:57:18

Just have a constant variable. :) const ISP = 'smtp.comcast.net'; Email = 'wat@wat.com'; PhoneNumber = '1234567890@vtext.com';

Death12652

2010-05-19 17:15:57

okay so you do have to change it according to the person. Just wandering and I did. Just making sure that it was the user not who its sending to.

Illkillutill

2010-05-19 21:24:09

If you want the script user to recieve the reports, than put the constants in, if not then leave it how it is.

Death12652

2010-05-19 22:32:37

I want to receive the report when they use it.

Illkillutill

2010-05-19 23:02:47

ok then just leave the script without the constants, because they will likely mess something up if they don't know what there doing…

Death12652

2010-05-19 23:14:24

so just leave it be… include the smtp.comcast.net part? what if they aren't using comcast?