Announcement

Collapse
No announcement yet.

Email with attachment using sendmail()

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

  • Email with attachment using sendmail()

    Hello,

    I wonder if anyone can help me on how to send and email with multiple attachments using sendmail(). I already did the form but didn't succeed.

    Thank you,

  • #2
    hi, so far could manage to send email with SMTP only without attachment,
    i was looking for php sendmail() as well but found this easier and worked pretty easy (the smtp) just have a user and password of any email account on your server... but for attachment, I'm yet struggerling (type image (filename))

    Comment


    • #3
      http://webcheatsheet.com/php/send_em...php#attachment should suffice for examples.... I guess..

      Comment


      • #4
        At the end to send email with more than one attachment is simple.

        1. You need the full path and filename of each file in the attachment.
        2. Place these data in an array.
        3. Take the code-example send email with attachment and fill out the vars with your data.
        4. Put the attachment array in the place of the attachment where it is suggested

        Have fun ...

        BR

        Eric

        Comment


        • #5
          yes Eric, this is to confirm the code example that inside SC is working, even if array, but you have guys to make double check the PATHS... and make sure your field is coming correctly... in our case, field was not coming correctly to the sending-email form... so we (Eric and me) assigned global variable to pull the field name and a long internal path /../../../../file/.{subfolder}.'/'.{field} so it worked, finally, see my previous posts for more info

          http://www.scriptcase.net/forum/show...iving-me-crazy

          but how to prevent and setup size limit for upload field, this is not solved yet for me
          http://www.scriptcase.net/forum/show...d-(Size-Limit)

          ROFL forl.jpg

          Comment


          • #6
            Originally posted by MikeDE View Post
            hi, so far could manage to send email with SMTP only without attachment,
            i was looking for php sendmail() as well but found this easier and worked pretty easy (the smtp) just have a user and password of any email account on your server... but for attachment, I'm yet struggerling (type image (filename))
            Hi Sir Mike,

            I'm using the security module created from scriptcase... when I added a new user this error occurs :
            Fatal error: Uncaught exception 'Swift_TransportException' with message 'Failed to authenticate on SMTP server with username "xxxxxx@gmail.com" using 2 possible authenticators' in C:\Program Files (x86)\NetMake\v8\wwwroot\scriptcase8\prod\third\sw ift\classes\Swift\Transport\Esmtp\AuthHandler.php: 176 Stack trace: #0 C:\Program Files (x86)\NetMake\v8\wwwroot\scriptcase8\prod\third\sw ift\classes\Swift\Transport\EsmtpTransport.php(307 ): Swift_Transport_Esmtp_AuthHandler->afterEhlo(Object(Swift_SmtpTransport)) #1 C:\Program Files (x86)\NetMake\v8\wwwroot\scriptcase8\prod\third\sw ift\classes\Swift\Transport\AbstractSmtpTransport. php(124): Swift_Transport_EsmtpTransport->_doHeloCommand() #2 C:\Program Files (x86)\NetMake\v8\wwwroot\scriptcase8\prod\third\sw ift\classes\Swift\Mailer.php(79): Swift_Transport_AbstractSmtpTransport->start() #3 C:\Program Files (x86)\NetMake\v8\wwwroot\scriptcase8\app\PPPProjec tsInfoSystem\secapp_form_edit_users\secapp_form_ed it_users_apl.php(3411): Swift_Mailer->send(Object(Swift_Message), Ar in C:\Program Files (x86)\NetMake\v8\wwwroot\scriptcase8\prod\third\sw ift\classes\Swift\Transport\Esmtp\AuthHandler.php on line 176

            What must be the problem? Do i need to adjust other configurations? My send_mail_to_new_user function parameters are as follows:

            // Email parameters
            $mail_smtp_server = 'smtp.gmail.com';
            $mail_smtp_user = 'myaccount@gmail.com';
            $mail_smtp_pass = 'mypassword';
            $mail_from = 'myaccount@gmail.com';
            $mail_to = {email};


            $mail_message = sprintf({lang_send_actcode_newuser}, $message);


            $mail_subject = {lang_subject_new_user};
            $mail_format = 'H';


            // Send email
            sc_mail_send($mail_smtp_server,
            $mail_smtp_user,
            $mail_smtp_pass,
            $mail_from,
            $mail_to,
            $mail_subject,
            $mail_message,
            $mail_format,
            '','', '465', 'S');
            sc_log_add("Send active code", {lang_sended_active_code});
            I'm still in a development mode/local machine..using Windows 7 Pro, scriptcase 8.0.016

            Thanks much!

            Comment


            • #7
              Hi Sir Mike,
              In relation to my inquiry above, I found this link regarding to comment-out first the function in sending email... and activate it later in a production environment.

              http://www.scriptcase.net/forum/showthread.php?6536-Error-while-creating-new-user!!-serious-one-(using-the-built-in-security-module)&highlight=sending+email


              Regards.

              Comment


              • #8
                Hi MySJ, yes that is because of the development enviornment, it will work in production as there will be SMTP server there but yet i works with SC mail function only, not with sendmail of PHP, but that is ok, it works at least

                cheers

                Comment


                • #9
                  @Mike
                  in the example shown above MySJ is working with the SC-funktion sc_mail_send ...

                  @MsSJ
                  I also would suggest to go on a production server first... Never tried the sec_module NewUser function on the developing-enviroment ....

                  BR

                  Eric

                  Comment

                  Working...
                  X