REVO7000email)with)attachment TutorialXfunction theMsgHTML theMsg replace cr with "
" in theMsg put "" into theHTML put ""&cr&\ ""&cr&\ ""&cr&\ ""&cr&\ ""&"Earth Explorer"&""&cr&\ ""&cr&\ ""&cr into theHtml put ""&"A Message from Earth Explorer"&"
"&cr after theHtmL put "
"&theMsg&"


"after theHTML return theHTML end theMsgHTML paj ^ UArialU Arial,unicodeWArialW Arial,unicodeW Arial,unicode cREVGeometryCache stackIDcRevStandaloneSettings &Windows,LegalCopyright#2012 All rights reserved worldwideWindows,productversion11 askDialogtrue OSX,copyright#2012 All rights reserved worldwideWindows,ProductName Untitled 1Windows,productversion30scriptLibrariesGeometry Printing UNIX,fileSelectortrueOSX,identifiercom..untitled1Windows,fileversion40 inclusionsselectWindows,documenticonFileq/Applications/LiveCode 5.5.3 (rc 2).app/Contents/Tools/Runtime/Windows/x86-32/Support/Sample Icons/genericdoc.icoOSX,shortVersion1.0.0.0OSX,documentExtensionname Untitled 1OSX,name Untitled 1 MacOSX x86-32falseWindows,fileversion20WindowstrueLinuxtrueWindows,FileDescriptionUntitled 1 1.0.0.0 for WindowsWindows,productversion20UNIX,pageSetuptrue OSX,signature????OSX,infoUntitled 1 Version 1.0.0.0Windows,productversion40Windows,companynameMacOSXtrueWindows,fileversion11OSX,documentTypeMacOSX PowerPC-32falseWindows,fileversion30UNIX,colorChoosertrue answerDialogtrueUNIX,printerChoosertrueWindows,iconFileq/Applications/LiveCode 5.5.3 (rc 2).app/Contents/Tools/Runtime/Windows/x86-32/Support/Sample Icons/genericapp.icoOSX,longVersionUntitled 1 1.0.0.0cursorstrue cREVGeneral  breakpointsbreakpointstatesscripteditorselection645breakpointconditionsscripteditorvscrollstackfileversion7.0 scalefactor? @j: cREVGeometryCacheIDs  1453589574431 1350510547167 1453246269323 1453580192570 1453589460312 1453589349004 1452994870434 1453589447859 cREVGeometryCache totalorder      queryResult)h&`pReturn of sql query goes here.   cREVGeneral  revUniqueID 1350510547167  (Output from the cgi should appear here. 'P It should say "Email sent" '4 `i'_ aO  Label Field z z  cREVTable  currentview %

Testing the phpSendmail script

 cREVGeneral  revUniqueID $uB Testing the phpSendmail script '< emailMsg)`&l  cREVGeneral  revUniqueIDx%uBscripteditorvscrollscripteditorselection0  (PUt your test email message in this box. 'P `'j}Test attachmentew --This uploads a file to my php script. --The data are sample data and you should check to make sure any paths --or URL's match you configuration, on mouseup put "" into fld "queryResult" put empty into tForm --the entry names. Don't change these unless your change the corresponding --value in the php script put "fromEmail" into key_1 put "destEmail" into key_2 --the destName will be the attached file that is sent to whereever. If it is an assignment --sent to the teacher, it should include the student's name and something that identifies -- the assignment, because it will probably end up in the teacher's mailbox with a bunch --of other students' work. put "destName" into key_3 put "theSubject" into key_4 put "theMessage" into key_5 put "mailpw" into key_6 put "attachmentname" into key_7 put "emailFromAddress" into value_1 --email address the message is from put "emailToAddress" into value_2 --destination email put "Name of person sending the email to" into value_3 put "Email Message Header" into value_4 put fld "emailMsg" into tMsg put theMsgHtml(tMsg) into value_5 put "random chars to match the ones in the php file" into value_6 --the following command is the name given to the file that is sent as an attachment -- to the receiver. It is only a name and is only used to create a name for the attached file. -- You can use anything, and as long as the sender's file name, with path is ok, it will work. put "My Name given to the attached file" into value_7 put 1 into isAnAttachment --set to 0 if there is no attachment put libURLMultipartFormData (tForm, key_1,value_1,key_2,value_2,key_3,value_3,key_4,value_4,key_5,value_5,key_6,value_6,key_7,value_7) into tErr if tErr is not empty then answer "Error in sendmail form" end if set the httpHeaders to line 1 of tForm if isAnAttachment = 1 then delete line 1 of tForm --put absolute path to file you want to attach to the email put "" & "/Users/Prothero/Desktop/phpmailer.png" into tFile put "file" into tType put "binary" into tEnc --in php this sets the $_FILES array. if libURLMultipartFormAddPart(tForm,"userfile", tFile, tType, tEnc) is not empty then ##handle error and exit exit mouseUp end if end if put "http://myServerAddress/scgi-bin/phpmail/myNameIGaveTheEmailPHPFile.php" into tURL post tForm to tURL put it into fld "queryResult" set the httpHeaders to empty end mouseup Test Email Attachment  cREVGeneral  revUniqueID'uBscripteditorvscrollscripteditorselection1503  phpScript!`fl  cREVGeneral  revUniqueID( 'uB   } ' ' D//Put the email message code here. If there is no upload no worries. ' require 'PHPMailerAutoload.php'; '@ $mail = new PHPMailer; ', :$mail->setFrom('author@earthednet.org', 'Earth Explorer'); 't *$mail->addAddress($tDestEmail, $destName); 'T $mail->Subject = $tSubject; '6 $mail->msgHTML($tMsg); ', .$mail->AltBody = $altbody = strip_tags($tMsg); '\ %//Attach footer image file to message 'J b//$mail->addAttachment('images/EmailLogo.png'); //if you want an image for a footer, set it here. ' // Attach the uploaded file '6 1$mail->addAttachment($uploadfile, $uploadedFile); 'b if (!$mail->send()) { '* , $msg = "Mailer Error: " . $mail->ErrorInfo; 'X } else { '  $msg = "Message sent!"; '0 echo $msg; ' } ' 0//delete the file. Don't want it hanging around. '` 5if (file_exists ($uploadfile) && $uploadedFile != "") 'j { ' ! unlink (realpath ($uploadfile)); 'B } ' ?> ' ' `ej{ ButtonewJon mouseUp show fld "phpScript" hide fld "Instructions" end mouseUp P"v Show PHP Code  cREVGeneral  revUniqueID0K 'uBscripteditorvscrollscripteditorselection62  ButtonewJon mouseUp hide fld "phpScript" show fld "Instructions" end mouseUp "Show Instructions  cREVGeneral  revUniqueIDU 'uBscripteditorvscrollscripteditorselection61  Instructions)`fly  cREVTable  currentview 

 cREVGeneral  revUniqueID1 'uB  This stack was created to help you implement an email (with attachments) service on your server. The instructions are meant for a Linux server running Apache. Other server environments should not be too different. This example uses php and allows you to attach a file to the email. '4 '  Why would you do this? If you have an app that used used at computers other than the user's personal computer, it may not have an email setup. For example, in a classroom situation where students sitat multiple computers, the resident email system may not function. #* '* ' ;First, download phpMailer at: http://phpmailer.worxware.com # ' l Next, you need to find your cgi folder and make sure it will execute php scripts. You will need to make a small php script with only the contents: # ' '  '$ ' 7Then, name it "test.php" and put it in your cgi folder. # 'f &Next, do http://yourServerURL/test.php # 'D ' If you can't get this script to work, you need to get technical assistance from somewhere else, as this is the starting point for this tutorial. # ' The web page that is shown by your test.php script gives you a nice summary of your php settings. There are three settings you need to check: Under the Engine table: 'J file_uploads must be "On" '2 Eupload_max_filesize limits the size of the file that can be uploaded ' Vupload_tmp_dir needs to be set the some location on the server. Mine is set at: /tmp ' ' HNote that the php script loads emails to the tmp directory with a randomized filename, sends the to the destination with the name you specify in the script, then erases it. If you get a nice web page output from the test.php file, and the above settings are as specified, you are ready to go on and install the email php script. ' ' RClick the "Show PHP Code" button below and copy the script to a text editor that can upload the file to your server's cgi folder. Edit the "myServer" parameters in the php script to match you server. Then Upload the file to your server. The permissions should be 0755 and the group and owner should be set to the owner of the site's name. ' ' You can go to your server url with http://myserverurl.org/phpInfo() and you will get a summary of your php installation settings. ' ' Good luck! ' `ej