On Tuesday, 10 April 2018 at 13:51:02 UTC, Adam D. Ruppe wrote:
On Tuesday, 10 April 2018 at 11:09:56 UTC, Vino wrote:
Now the program works, but the attachment does not work as expected,

message.addAttachment("text/plain", "C:\\Temp\\Test\Test1.txt", "Test");

What did you expect that "Test" argument to do if it was going to read the file as the content? I guess I should change the documents on this. The way it works is the filename argument is just what is seen in the email as a suggestion name for the user to download the attachment, and the content argument is what is what's inside that attachment.

Since the attachment name just suggests a name, and the user decides where to put it, it should NOT have a path name.

So try this instead:

addAttachment("text/plain", "Test1.txt", std.file.read("C:\Temp\Test\Test1.txt"));

so the name argument is JUST the name to suggest to the user, then the content argument gives the content of your file to attach - which here is read from the file on disk via the phobos std.file read function.

Hi Adam,

Thank you very much, the program now works, but i need to make some adjustment, if possible can you please help me on this.

The variable "to" is of type string[] but we need it as Array!string
The variable "Subject" but we need it as Array!string.


Reply via email to