Jump to content

PHP Mail Help


Recommended Posts

So I'm trying to build a full-featured application that will, whenever a flash drive is plugged in with the application on it, send an email to the owner of the flash drive with a bunch of useful information (external IP, internal IP, computer name, user name, etc.) as well as log all of this information to a protected file on my website. I have gotten EVERYTHING to work (as in, log it to the website) except I cannot get the email to go through.

When I was using an AutoIt email function that I found, it worked like a charm. However, it would not work at my school (which is why I'm making this utility in the first place) because my school blocks SMTP transactions. However, they do not block communication to my website (I know this because the information would still be logged, it just wouldn't send the email). When I tried to send the email using this script for PHP, the logging section always works flawlessly, but the mail section never works. No errors or anything are given:

<?php
//LOG
$fn = $_GET["File"];
$fh = fopen($fn, 'w') or die("can't open file");

$PageTitle = $_GET["PageTitle"];
$CInfo = $_GET["CInfo"];
$DInfo = $_GET["DInfo"];
$UInfo = $_GET["UInfo"];

fwrite($fh, "<html><head><title>".$PageTitle."</title></head><body>\n");
fwrite($fh, $CInfo."<br /><br />\n");
fwrite($fh, $DInfo."<br /><br />\n");
fwrite($fh, $UInfo."</body></html>\n");
fclose($fh);

//EMAIL

$CEmail = $_GET["CEmail"];
$Body = $_GET["Body"];

$subject = 'USBFind Test';

$header  = 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

mail($CEmail, $subject, $Body, $header);
?>

This is the AutoIt code that is given:

$Host = "(my-website.com)"
$InfoDir = "/usbfind"
$InfoPage = $InfoDir & "/getinfo.php"

$FileDir = "logs/"
$FileName = "(filename)"
$FileExt = ".html"
$File = $FileDir & $FileName & $FileExt

$Info = "&PageTitle=" & $FileName & _
    "&CInfo=" & $CInfo & _
    "&DInfo=" & $DInfo & _
    "&UInfo=" & $UInfo & _
    "&Email=" & $CEmail & _
    "&Body=" & $Body & _
    "&File=" & $File

$hEString = $InfoPage & "?" & _HTTPEncodeString($Info)
$hConnect = _HTTPConnect($Host)
$hGet = _HTTPGet($Host, $hEString, $hConnect)

Any help you can provide is greatly appreciated; I've been trying to figure this out for about a year now and just now became interested in making the application again. Please help me xD.

P.S. The logging code that I used (PHP & AutoIt) was taken and edited from killerofsix' USB Finder codes (found ).

TheMusiKid

Edited by TheMusiKid
Link to comment
Share on other sites

It's not $_GET["CEmail"]. It's $_GET["Email"].

Wow...

Thank you.

So much.

You rock so hard; it works now. My program is complete!

Thanks again, I didn't even notice that xD.

EDIT: It appears as if you tried to tell me before; I can't see green on this site very well and didn't see that you changed the color the first time. Sorry about that.

Edited by TheMusiKid
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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