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,

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))

http://webcheatsheet.com/php/send_email_text_html_attachment.php#attachment should suffice for examples… I guess…

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

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 :smiley:

http://www.scriptcase.net/forum/showthread.php?6854-sending-email-with-image-attachment-driving-me-crazy

but how to prevent and setup size limit for upload field, this is not solved yet for me :smiley:
http://www.scriptcase.net/forum/showthread.php?6648-Multi-Upload-(Size-Limit)

ROFL

forl.jpg

[QUOTE=MikeDE;26212]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))[/QUOTE]

Hi Sir Mike,

I’m using the security module created from scriptcase… when I added a new user this error occurs :

[INDENT]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 hird\swift\classes\Swift\Transport\Esmtp\AuthHandler.php:176 Stack trace: #0 C:\Program Files (x86)\NetMake\v8\wwwroot\scriptcase8\prod hird\swift\classes\Swift\Transport\EsmtpTransport.php(307): Swift_Transport_Esmtp_AuthHandler->afterEhlo(Object(Swift_SmtpTransport)) #1 C:\Program Files (x86)\NetMake\v8\wwwroot\scriptcase8\prod hird\swift\classes\Swift\Transport\AbstractSmtpTransport.php(124): Swift_Transport_EsmtpTransport->_doHeloCommand() #2 C:\Program Files (x86)\NetMake\v8\wwwroot\scriptcase8\prod hird\swift\classes\Swift\Mailer.php(79): Swift_Transport_AbstractSmtpTransport->start() #3 C:\Program Files (x86)\NetMake\v8\wwwroot\scriptcase8\app\PPPProjectsInfoSystem\secapp_form_edit_users\secapp_form_edit_users_apl.php(3411): Swift_Mailer->send(Object(Swift_Message), Ar in C:\Program Files (x86)\NetMake\v8\wwwroot\scriptcase8\prod hird\swift\classes\Swift\Transport\Esmtp\AuthHandler.php on line 176
[/INDENT]

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

[INDENT][I]// 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][/INDENT]

I’m still in a development mode/local machine…using Windows 7 Pro, scriptcase 8.0.016

Thanks much!

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. :)[URL=“http://www.scriptcase.net/forum/showthread.php?6536-Error-while-creating-new-user!!-serious-one-(using-the-built-in-security-module)&highlight=sending+email”]

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.

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

cheers

@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