Results 1 to 9 of 9

Thread: Q about PHP email relay and message length

  1. #1

    Thread Starter
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Q about PHP email relay and message length

    Hi,

    First off, I haven't got a clue about what PHP can do or how it works.

    I have a potential client that wants to receive Security reports from his clients.

    He wasn't happy with the VB solutions I offered him and he suggested using PHP,
    Which he really doesn't know anything about.

    Points:
    1. The Reports will vary in size.
    I am guessing the average report will be about 5000 characters long,
    but could be double that or more.

    To put it better way, How large of a message can PHP send in an email?

    2. They will contain external URLs and paths to files on the users computer
    and possibly other html control characters.

    3. They may also contain some of the users personal info.


    Can PHP relay these email report safely from his clients to him?

    What will he need if it can do it?

    1. Will he need a web site/server to host the PHP script.
    2. And will he need permission to run things like CGI scripts?
    3. will he need someone to admin the php script?
    4. And is there anything else he/I need to know about?

    Thanks
    Last edited by longwolf; Apr 27th, 2004 at 06:54 PM.

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    First off PHP is a server side interpreted scripting language. It can either be compiled into the web server as a module or run externally as a CGI script. It can also serve as a command line interpreter and execute scripts imilar to bash or batch files.

    What you are really looking for is a way of pushing data to the client at the servers discretion and/or the administrators. Hence the PHP script will run at regular intervals to send out the e-mail.

    You can transfer as much data as you wish in an e-mail and 5000 characters (about 5KB) isn't much data.

    To do this you will at the very least need the following:
    • A working installation of PHP - with support compiled in for your choice of database.
    • A database management system configured and installed on the server.
    • A mail transfer agent to send the e-mail or an SMTP server (such as you ISP's) which you can use to relay the mail.

    With regard to security - e-mail is sent in plain text and any information tansferred via e-mail is done so insecurely.

    If these reports contain personal data then it may be best to have a report requested from a secure web server.

    You could do this by having the PHP script run at regular intervals to generate a static HTML page and send an e-mail notification to the viewer of the report containing a link to the report.

    If you wanted to do this you would also need to install and configure a web server with SSL support, however this is far easier than setting up and communicating with a secure mail transfer agent.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343
    <quote>
    What you are really looking for is a way of pushing data to the client at the servers discretion and/or the administrators. Hence the PHP script will run at regular intervals to send out the e-mail.
    </quote>

    I'm afraid that's backwards.
    My VB app generates the report on the clients/users machine.

    Now we need a way to get the report from them to my client(the guy I'm making this for)

    A plain Winsock app isn't working if the user's mail server uses SMTP authorization (EHLO).
    I'm trying to find a work around.

    I have a better discription at this link:
    http://www.vbforums.com/showthread.p...hreadid=288001

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    The VB APP can authorize itsself with an SMTP server. I can give you instructions on how to do this if you wish.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5

    Thread Starter
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343
    If you know how to get VB6 to pass an ESMTP EHLO authorization,
    YES PLEASE TELL ME!!!

    I've been trying for days and haven't found anything that works consistently.

  6. #6
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    Firstly you've got to find out what kind of authorization the SMTP server supports.

    This can be determined by sending EHLO to the SMTP server. Here's a sample of what you may get:
    Code:
    220 mail.host.com ESMTP Postfix
    EHLO vbapp
    250-mail.host.com
    250-PIPELINING
    250-SIZE 10240000
    250-ETRN
    250-STARTTLS
    250-AUTH PLAIN LOGIN
    250 8BITMIME
    EHLO gives you the information back on what the server can do. From its output you can see that the server supports plain text authentication. This is quite simple to code for in VB and just requires base 64 encoding the credentials.

    More advanced authentication methods such as CRAM MD5 are more complex to code but I am quite confident these can be done in VB.

    Find out what authentication the server offers and I'll give you some instructions on how to code it.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  7. #7

    Thread Starter
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343
    Yes, I understand how to find the encoding they want.
    And i have a Base64 module

    The problems are, What do they want encoded and in what format.

    The may want username and password
    They may just want user name.
    They may want two pieces of info separated with some character know only to them.
    They may want two pieces of info but on two diff lines.

    From what I've read there is no standard for the info they will exspect to have encoded.

    If I'm wrong, please let me know the standard because nothing I've tried has worked consistantly.

  8. #8
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906
    Well. If I take the plain authenticaiton as an example the following dialog will take place with the SMTP server:
    Code:
    EHLO
    250-mail.host.com
    250-AUTH PLAIN LOGIN
    AUTH PLAIN
    334
    AHVzZXJuYW1lAHBhc3N3b3Jk==
    250 Authentication Successful
    First you send EHLO to determine the authentication method to use. Then you use AUTH to tell the server you wish to authenticate yourself. This command is accompanied by the authentication mechanism you wish to use. Plain in this case:
    AUTH PLAIN

    The server then sends a challenge - 334. The next thing you send should be the authentication response. This is the username and password base-64 encoded in the format:

    \0username\0password

    Where \0 is a null character. This can be emulated in VB using the Chr(0).

    If the authentication is successful the server returns with a 250 response.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  9. #9

    Thread Starter
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343
    Thx visualAd,

    That part of the project got scrubbed.

    I'll try this out whe i get the time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width