Note that there are some explanatory texts on larger screens.

plurals
  1. POhow do i send attachments using lua sockets / smtp?
    primarykey
    data
    text
    <p>I have the following code: </p> <pre><code>local email_credentials = function(email_address, password, username) local from local contents = read_email_contents_file() contents= string.gsub(contents, "&lt;&lt;password&gt;&gt;", password) from = "&lt;CAdmin@test.net&gt;" rcpt = { "&lt;"..email_address.."&gt;" } mesgt = { headers = { to = email_address, ["content-type"] = 'text/html', subject = "Your Password" }, body = contents } r, e = smtp.send{ from = from, rcpt = rcpt, server = 'localhost', source = smtp.message(mesgt) } end </code></pre> <p>Found this post: </p> <p><a href="http://lua-users.org/lists/lua-l/2005-08/msg00021.html" rel="nofollow">http://lua-users.org/lists/lua-l/2005-08/msg00021.html</a></p> <p>I've tried changing the header section to look like: </p> <pre><code> headers = { to = email_address, ["content-type"] = 'text/html', ["content-disposition"] = 'attachment; filename="/var/log/test.log"', subject = "test email with attachment" }, </code></pre> <p>but that didn't work. THe email sent / received but with no attachment. </p> <p>Any help would be appreciated.</p> <p>Thanks</p> <p><strong>EDIT 1</strong></p> <p>I've added the following two lines: </p> <pre><code> ["content-description"] ='test description', ["content-transfer-encoding"] = "BASE64" </code></pre> <p>and now I get an attachment. However, the data is all jumbled. Looks like this:</p> <blockquote> <p>=«,ŠÝrm/'LŒq©ÚuÜ!jׯz»^ÆÜÁ©í¶‹aŠÇ¦j)</p> </blockquote> <p>The contents of the file is just text.... Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload