Hi
I can’t get any attachment from my server event Row_Updated: email worked as expected but when trying to attach an uploaded document email gone out with no attachment.
Note that your $rsnew[“ata_document”] is only the file name, you need to specify the path so that it can be found, or put the files in the global upload folder.
Tnx
the document is already in the global upload folder.But the strange thing is when I make
var_dump($rsnew[“ata_document”]);
the result is NULL.Other fields are correctly displayed.When inspecting the db via phpmyadmin i can see the name of the document in the field ata_document.I don’t understand
The “content” is file content as string, not content type. If you use physical file (not content as string), you should remove the content setting and provide absolute path as file name.
$arAttachments[] = array("filename" => $fileName);
$arAttachments[] = array("filename" => $fileName, "content" => '');
$arAttachments[] = array("filename" => $fileName, "content" => 'application/pdf'); (this is the only case wich the attachment is sent but unreadable)
Again, “content” is not content type. If you want to use content, you can use get the file as string by file_get_contents(), then the “filename” must the file name only, not absolute path.
If you use “filename” without “content”, the “filename” is the absolute physical file path on your server, not URL. (PHPMailer also uses file_get_contents() to load file, file_get_contents() can also open URL, but if the file is on your own server, there is no need to load by URL.)
Thank You for your patience,
I managed to send the email with the attachment exactly as you taught me.Here’s the code I inserted in Row_Inserted event: