sending email attachments from Linux works but not in Windows
Heriberto Torrado
htorrado at networkdreams.net
Thu Aug 20 18:02:21 EDT 2020
Dear livecode programmers,
I'm going crazy trying to send three attachments in one email using the tsNet external function.
it works in Linux without problems (Fedora 32), but from Windows it doesn´t (Windows Server 2019).
I get the emails from Windows, but there are no attachments.
I have tried a thousand things:
* Putting the Special folder to Desktop, Documents or Temporary
* Turning “/” into “\”
* Using non Zipped files.
* Adding “\” or “/” to the path
* Adding “\” or “/” in from of the name of the files
Nothing seems to work
Livecode Version: 9.6.0 Indy
Test Machines:
Fedora32 (development machine) : It works like a charm.
Windows Server 2019 (development machine): It doesn’t work.
This is my code.
-- Variables
local tUrl, tEmailMessage, tRecipient, tBody, tFrom, tTo, tCc, tSubject, tAttachments
local tSettings, tResult, tBytes, tResponseHeaders
-- Specify the e-mail server settings
-- Server
put "smtp://nwd-lnx01.networkdreams.net/" into tUrl
-- Username
put "htorrado at networkdreams.net" into tSettings["username"]
-- Password
put "thepassword" into tSettings["password"]
-- Enable TLS for SMTP
-- TLS seems to no work, so I put it to false (it works)
put false into tSettings["use_ssl"]
-- Body
put "Esto es una prueba de envío de ficheros adjuntos" into temailMessage
-- Encode the e-mail message body
put mimeEncodeFieldAsMIMEMultipartDocument(temailMessage) into tBody
-- Attachments (3)
put specialfolderpath("Home") into filepath
put "Questions1.zip" into tAttachments[1]["filepath"]
put "Questions2.zip" into tAttachments[2]["filepath"]
put "Questions3.zip" into tAttachments[3]["filepath"]
-- From, to, CC, Subject
put "htorrado at networkdreams.net" into tFrom
put "htorrado at networkdreams.net" into tTo
put "info at networkdreams.net" into tCc
put "Test" into tSubject
-- Encode the e-mail headers and body
mimeEncodeAsMIMEEmail tBody, tFrom, tTo, tCc, tSubject, tAttachments
put it into tEmailMessage
-- Make tRecipient a list of all recipients (To and Cc)
put tTo & cr & tCc into tRecipient
-- Send the e-mail
put tsNetSmtpSync(tURL, tFrom, tRecipient, tEmailMessage, tResponseHeaders, tBytes, tSettings) into tResult
-- Check the result
if the first word of tResult is "tsneterr:" then
answer "Error" && tResult && "returned from server"
else
answer "E-mail sent"
end if
Best regards/ Saludos cordiales/ Cordialement
Heriberto Torrado
Chief Technology Officer (CTO)
Director de informática
Directeur informatique
NetDreams S.C.
<http://www.networkdreams.net/> http://www.networkdreams.net
Address / Dirección / Adresse:
USA: 538 East 85th Street, #1C Manhattan NY, NY 10028 USA
Europe / Europa: Paseo de la Castellana 135 10ª Planta Madrid 28024 Spain / España
Tel - Phone - Fax:
Phone / Tel USA : +1 917 287 5644 / +1 646 596 8787
Phone / Tel Spain :+34 627 556 500 / + 34 91 063 74 48
Please consider the environment before printing this email / Por favor considera tu responsabilidad medioambiental antes de imprimir esta página.
Confidentiality: The information contained in this message as well as the attached file(s) is confidential/privileged and is only intended for the person(s) to whom it is addressed. If the reader of this message is not the intended recipient or the employee or agent responsible for delivering the message to the intended recipient, or you have received this comunication in error, please be aware that any dissemination, distribution or duplication is strictly prohibited, and can be illegal, and please notify us immediately and return the original message to us at the address above. Thank you.
Confidencialidad: La información contenida en este mensaje y/o archivo(s) adjunto(s) es confidencial/privilegiada y está destinada a ser leída sólo por la(s) persona(s) a la(s) que va dirigida. Si usted lee este mensaje y no es el destinatario señalado, el empleado o el agente responsable de entregar el mensaje al destinatario, o ha recibido esta comunicación por error, le informamos que está totalmente prohibida, y puede ser ilegal, cualquier divulgación, distribución o reproducción de esta comunicación, y le rogamos que nos lo notifique inmediatamente y nos devuelva el mensaje original a la dirección arriba mencionada. Gracias.
Viruses: Although we have taken steps to insure that this e-mail and attachments are free from any virus, we advise that in keeping with good computing practice, the recipient should ensure they are actually virus free.
Virus: Aunque hemos tomado las medidas para asegurarnos que este correo electrónico y sus ficheros adjuntos están libres de virus, le recomendamos que a efectos de mantener buenas prácticas de seguridad, el receptor debe asegurarse que este correo y sus ficheros adjuntos están libres de virus.
More information about the use-livecode
mailing list