Announcement

Collapse
No announcement yet.

A button to send email from "Detail" screen

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Hi Mike,

    for the attachment you will need the whole path plus filename. That was the mistake I made ^^ Forgot the subdirectory, where I stored the files to.

    BR

    Eric

    Comment


    • #17
      hmmm do you mean like www.domainname.com/scaproject/scapplication/storagefolder/{fieldname} ? or just storagefolder/{fieldname}

      Comment


      • #18
        Addresses are taken relative to the root. But why not just experiment. One test and you know it all?
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development
        www.scriptcase.eu / www.scriptcase.nl

        Comment


        • #19
          hi Albert, because this sc8 drives me crazy, many things are not functional as I want really feeling bad and wanna move this project to sc7,,, it is correct i need this email thing but i have to finish other tasks too and stuck in group by dilemma now,, will try them all because the mail function needs to deploy to a server to test... thats why i am putting as the last thing before the security apply then deploy and test

          Comment


          • #20
            Just deploy to another server directory to test. I can say, that the V8 mail function is working.

            Btw, both should work, relative and inet path format.

            Comment


            • #21
              hi again, it gives me blank white page when trying to send! don't know why
              first, gave me error, as the field that has the attachment was empty (there was no attachment in that record) is that necessary to have the attachment!! maybe the recod wasn't filled with attachment, is it important to have attachment (image) otherwise it will not send! it doesn't make sense

              also, the path thisway upload/{fieldname} hope it is okay

              one more thing, for the mail server information, i just filled the "localhost", all others kept them empty, i have the mailto, subject and the from email... i mean there is no username and password for SMTP does this mean will send using php function like other PHP email scripts or not? if not, how i can use the php function sending instead of the stmp?

              Comment


              • #22
                I am nearly sure that the account information are necessary, but never tried that. Always used them. An empty attachment array should work.

                Normally you can use nearly every php-code within SC. But if this is an solution ???? I know, I repeat myself, but once again the SC-mail-function is working.

                BR

                Eric

                Comment


                • #23
                  yes i know, and i am sure it is because of me i'm not able to do it currently dude the SC mail function!! although, sc has other bugs than this but didn't read a lot problems about mail function so i assume it is ok with everybody, or they dont use it at all it is okay, if other people read this thread, then might face this problems and avoid them so everyone will win

                  phpfunction sendmail() usually sends without user and password, it depends on the localhost like an internal account on the mail server which is usually on the same machine, and is pretty perfect for notifications and such things... but i am not sure they didn't include how to use it in SC, they require SMTP configuration which makes you always configure, write new codes with new ports/settings, then deploy, remove your cache then try and try... they have email examples in their examples database which comes with sc but it is also not well informative....

                  let me tell you what is SC from in my opinion:
                  1- for expert users: great tool to minimize the time for them, they can do workarounds in just few steps, overcome any small issue with alternatives, codes, blank application (which i don't know anything about it yet ) merge and use libraries, use external classes... so for them is just a tool to facilitate their work as fun, and for some projects they may not use it at all!

                  2- for medium experienced users: will see it beneficial as it will give them pretty nice applications, good design, strong functions all in one, but they still lack of how to cover small things and how to workaround things quickly, and they stuck sometimes

                  3: for beginners and low experience, they use only what they can manage, sometimes don't use a strong function not to get lost a lot of power but don't know how to "drive" it well, then i put my self in this group and try then try my best to gather "driving" information together,, going forward to group no 2 above, perhaps i can collect these rules and be givers to other people to return at least a little of what I learnt from these guys in group1!

                  remains the experience in PHP and other stuff that one used before SC and general knowledge about codes... if you put all that together, and know how to merge codes from here and there then use them with SC, workaround the bugs and find alternatives, then one is going to be in group 1, like jsb, Giu, adocum, EricB, Scott and other big names who can finish up a problem that made me busy for days (thankfully) in 2 lines code and a single idea! they usually like to help, but they also have time limitation and other stuff other than teaching groups 2 and 3, as a matter of fact, gurus are gurus, java gurus specially, code less do more right!? that is the experience my friend

                  i know myself writing too long, this is bad habit, i know, tried to stop it but couldn't, my bad


                  cheers

                  Mike
                  Last edited by MikeDE; 08-20-2014, 06:53 AM.

                  Comment


                  • #24
                    H Eric,

                    so far so good in his subject, I could manage to arrange the form in better way and could make it send email normally using SMTP ---- thanks to you

                    yet trying with the attachment, no luck yet, but as Albert said, i will keep trying to experment it more and more


                    remains the switch off button and switch on again, the first part of switching it OFF onScriptInit Worked fine, but on ajax event mailto field can't switch it back on again, don't know why here is my code

                    Code:
                    On mailto field : ajax OnChange: 
                    
                    
                    
                    if ({mailto} !== '')  
                    {
                    	sc_btn_display('Send', 'on');
                    }
                    else
                    {
                    	sc_btn_display('Send', 'off');
                    }
                    And in OnScriptInit this is the code, seems working, it is hiding he "Send" button when form is loaded...


                    Code:
                    if ({mailto} = ' ')   
                    {
                    	sc_btn_display('Send', 'off');
                    }
                    else 
                    {
                    	sc_btn_display('Send', 'on');
                    }
                    Whats wrong? bad code?

                    Comment


                    • #25
                      Hi Mike,

                      code is OK. My suggestion seems to be wrong. I think the button needs a reload to be switched off. I checked my code, seems I had the same problem.
                      Simply put test at the beginning of the send button code a test if {mailto} is set. At the end of that code reset the {mailto} field ...

                      BR

                      Eric

                      Comment


                      • #26
                        No luck yet, this is annoying if you corrected your code please let me know thanks

                        Comment


                        • #27
                          hi again, here is what how it worked
                          the button should be selected to show on update, if select not to show on update, then even if the macro is ok it will not show!

                          so, form event: onload,

                          sc_btn_display('Send', 'off');

                          then on ajax event onChange {mailto}

                          sc_btn_display('Send', 'on');


                          this will however not check for email validation or other field make sure it is filled (e.g. the recipient name or subject)

                          but it is better than nothing

                          now fighting back to make the attachment work looooooool

                          Comment


                          • #28
                            What is about

                            Code:
                            if (empty({mailto}))   
                            {
                            	sc_btn_display('Send', 'off');
                            }
                            else 
                            {
                            	sc_btn_display('Send', 'on');
                            }
                            BR

                            Eric

                            Comment


                            • #29
                              yes, the empty switch worked this way it is covering the basic needs eventually

                              FYI: also applied the same for nameto field, so now user has to add them both loool

                              okay, back to the attachment, simple i have the field name is {image2} and the sub folder is {caseid} so it is created when first the image is uploaded and eliminate the need of renaming...etc

                              i have tested this options for the attachment so far, but never worked, always swift throwing the error regarding the path..


                              in development (tried each one of these, a time):

                              $mail_attachments = /file/.{caseid}./.{image2};

                              $mail_attachments = scriptcase/app/myproject/file/.{caseid}./.{image2};

                              $mail_attachments = scriptcase/file/.{caseid}./.{image2};

                              $mail_attachments = scriptcase/app/myproject/file/.{caseid}./.{image2};

                              $mail_attachments = /file/.{caseid}./.{image2};

                              $mail_attachments = D:/sc8/wwwroot/file/.{caseid}./.{image2};

                              $mail_attachments = D:\sc8\wwwroot\file/.{caseid}./.{image2};



                              in production: (again, tried each one of these a time)

                              $mail_attachments = /file/.{caseid}./.{image2};

                              $mail_attachments = /public_html/site.com/myproject/file/.{caseid}./.{image2};

                              $mail_attachments = http://site.com/myproject/file/.{caseid}./.{image2};


                              i tried also with and without dots affront of the file names, as well as with and without slashes.... moreover, tried to add it as an array as one of the examples in the examples DB

                              all didn't work so far

                              what you think about this? i assume that this part "$this->Ini->path_doc." does replace to a corrected full file path that is determinded by sc when deployment... but also didn't work with me adding {image2} instead of the {file}

                              $attach = $this->Ini->path_doc.'/'.{file};

                              also tried
                              $attach = $this->Ini->path_img.'/'.{file};


                              no use

                              Comment


                              • #30
                                here is the rest guys who is looking for similar problem:

                                http://www.scriptcase.net/forum/show...ll=1#post26476

                                Comment

                                Working...
                                X