Sc_mail_send attachment problem

Hi guys,

I made an php button to send an email with the attachment of wich the filename is stored in the current record and the attachment is uploaded to _lib/file/doc. My problem is that whatever I try my attachment is not attached tot my email.

This is what I have done :

  • In the onload event I save the attachments name into the global variable [attachment].
  • In my mail definition I have : $mail_attachment = $this->Ini->path_doc.’/’.[attachment];
  • this parmeter is the last parameter in sc_mail_attachment

When I glue this string onto my content everything looks nice /home/<mylinuxuser>/domains/<mydomainname>/private_html/npl3/_lib/file/doc/<myfilename>. Yes that looks the right path from root and the document is there. Check.

The scriptcase documentation and the example look a little bit contraditionary: in the documentation is stated that is the attachment value should contain the absolute path to the document. But in the scriptcase example it is an array. What is it an absolute path or an array containing the absolute path ?

// ****************** SCRIPTCASE EXAMPLE ************************************************** ***********//
$mail_attachments = array( // List of attached files (located on the web server)
‘/path_to_file/attached_file.txt’
);
// ************************************************** ************************************************** ********* //
I also tried this example http://www.scriptcase.net/samples/tutoriais/programming/mcr13.php. No result.

When I try putting in in an array scriptcase raises an exeption “Array to string conversion”. But no error when I put this code
$mail_attachments = $this->Ini->path_doc.’/’.[attachment]; The example given the correct parameters does not work.

My mail is ok but my attachment does not arrive ??? Where do I go wrong?? Suggestions will be very welcome.

Thanks
Roelof

Hi,

This problem kept me busy for a day. But it finally works.

This is the correct way to do it: (the rest of the parameters is different for each user)
The document name is stored in $doc1.

$mail_copies = {ccmail};
$mail_tp_copies = ‘’;
$mail_subject = $param_subject; // Message body
$mail_format = ‘H’; // Message format: (T)ext or (H)tml
$mail_attachment = $this->Ini->path_doc.’/’.$doc1;
$mail_message = $param_message;

sc_mail_send(’$mail_smtp_server’,
‘$mail_smtp_user’,
‘$mail_smtp_pass’,
‘$mail_from’,
‘$mail_to’,
‘$mail_subject’,
‘$mail_message’,
‘H’,
‘$mail_copies’,
‘H’,
‘’,
‘25’,
‘$mail_attachment’);

Exactly. The attachment needs a full path to the file