Changing Content-Disposition to be inline

Just starting out? Need help? Post your questions and find answers here.
stevylake
User
User
Posts: 24
Joined: Fri Apr 05, 2019 6:50 pm

Changing Content-Disposition to be inline

Post by stevylake »

Hello,

I found this code on the forum to poke in a bit of HTML code into an email using the PB inbuilt MAIL commands. The code was from several years ago, 2012 I think.

What should happen is that the attachment is shown inline (awesome) as opposed to 'an attachment' (crap).

Code: Select all

InitNetwork()
If CreateMail(0, "no-reply@samsapplications.com", "Hello last !") ;from email address
 ;SetMailBody(0,"<html><b>This is a test</b></html>")  ; no mail Body
     AddMailAttachment(0, "Please read", "C:\samsapps\somehtml.html","text/html") ; HTML
     SetMailAttribute(0, #PB_Mail_Custom,"Content-Disposition: inline"+ #CRLF$+"Content-Type: text/html; charset=UTF-8") ; if we could change the Content-Disposition from attached to inline
      ; it has To be an attachment no Data attachment or it wont work
     ;
  ; Change the recipients to real one
  ;
   AddMailRecipient(0, "stevyjlake@gmail.com", #PB_Mail_To)
  ; Set the SMTP server to use
  ;
  Result = SendMail(0, "mail.samsapplications.com" , 465 , #PB_Mail_UseSSL , "????????@samsapplications.com", "?????????")

   Repeat
    Progress = MailProgress(0)
    Delay(300)
  Until Progress = #PB_Mail_Finished Or Progress = #PB_Mail_Error
   If Progress = #PB_Mail_Finished
    MessageRequester("Information", "Mail correctly sent !")
  Else
    MessageRequester("Error", "Can't sent the mail !")
  EndIf
 
EndIf
It doesn't work because the SetMailAttribute() is getting over-ridden later in the email source file.

To: stevyjlake@gmail.com
Date: Sun, 28 Mar 2021 15:51:53 +0100
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="Message-Boundary2650063341846741"

Content-Disposition: inline

Content-Type: text/html; charset=UTF-8
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname - chi-node59.websitehostserver.net
X-AntiAbuse: Original Domain - gmail.com
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain - samsapplications.com
X-Get-Message-Sender-Via: chi-node59.websitehostserver.net: authenticated_id: samsappl/from_h
X-Authenticated-Sender: chi-node59.websitehostserver.net: no-reply@samsapplications.com



--Message-Boundary2650063341846741
Content-Type: text/html;
name="Please read"
Content-Transfer-Encoding: base64

Content-Disposition: attachment



I suspect the anti abuse header, not put in by me of course, is having something to do with it.

The net result is that the attachment is never viewed inline (awesome) but as an attachment (crap).

Any thoughts would be appreciated.