AddMailAttachment()

Syntax

Result = AddMailAttachment(#Mail, Description$, Filename$ [, MimeType$])
Description
Add a file attachement to the #Mail. 'Description$' will be the information string displayed in the mail. 'Filename$' is the file to be added as an attachement. Once the attachment is added, the local file may changed or deleted, as the entire content of the file is copied and attached to the mail. If the attachment can not be created, 'Result' will be 0.

The optional 'MimeType$' parameter allows for the specification of which type of file is to be attached. If this parameter is omitted, then the file extension will be used to determine that files mime type. Below there is a list of the available mime types. If the extension of the file does not match any of the available mime types, then the "application/octet-stream" mime type will be used.
  application/acad          | AutoCAD    dwg
  application/clariscad     | ClarisCAD  ccad
  application/drafting      | MATRA Prelude drafting   drw
  application/dxf           | AutoCAD  dxf
  application/i-deas        | SDRC I-deas  unv
  application/iges          | Format d'échange CAO IGES   igs,iges
  application/oda           | ODA  oda
  application/pdf           | Adobe Acrobat  pdf
  application/postscript    | PostScript   ai,eps,ps
  application/pro_eng       | ProEngineer  prt
  application/rtf           | Rich text   rtf
  application/set           | CAO SET  set
  application/sla           | stéréolithographie   stl
  application/solids        |  MATRA Solids   dwg
  application/step          | de données STEP  step
  application/vda           | de surface   vda
  application/x-mif         | Framemaker   mif
  application/x-csh         | Script C-Shell (UNIX)   dwg
  application/x-dvi         | texte dvi  dvi
  application/hdf           | de données   hdf
  application/x-latex       | LaTEX  latex
  application/x-netcdf      | netCDF   nc,cdf
  application/x-sh          | Script Bourne Shell   dwg
  application/x-tcl         | Script Tcl  tcl
  application/x-tex         | fichiers Tex  tex
  application/x-texinfo     | eMacs  texinfo,texi
  application/x-troff       | Troff  t,tr,troff
  application/x-troff-man   | Troff/macro man  man
  application/x-troff-me    | Troff/macro ME   me
  application/x-troff-ms    | Troff/macro MS   ms
  application/x-wais-source | Source Wais   src
  application/x-bcpio       | CPIO binaire  bcpio
  application/x-cpio        | CPIO Posix  cpio
  application/x-gtar        | Tar GNU   gtar
  application/x-shar        | Archives Shell  shar
  application/x-sv4cpio     | CPIO SVR4n  sv4cpio
  application/x-sv4crc      | CPIO SVR4 avec CRC  sc4crc
  application/x-tar         | compressés tar   tar
  application/x-ustar       | compressés tar Posix   man
  application/zip           | compressés ZIP   man
  audio/basic               | audio basiques   au,snd
  audio/x-aiff              | audio AIFF   aif,aiff,aifc
  audio/x-wav               | audio Wave   wav
  image/gif                 | Images gif  man
  image/ief                 | Images exchange format  ief
  image/jpeg                | Images Jpeg   jpg,jpeg,jpe
  image/png                 | Images Png  png
  image/tiff                | Images Tiff   tiff,tif
  image/x-cmu-raster        | Raster cmu  cmu
  image/x-portable-anymap   | Anymap PBM   pnm
  image/x-portable-bitmap   | Bitmap PBM   pbm
  image/x-portable-graymap  | Graymap PBM  pgm
  image/x-portable-pixmap   | Pixmap PBM   ppm
  image/x-rgb               | Image RGB   rgb
  image/x-xbitmap           | Images Bitmap X   xbm
  image/x-xpixmap           | Images Pixmap X   xpm
  image/x-xwindowdump       | Images dump X Window  man
  multipart/x-zip           | archive zip  zip
  multipart/x-gzip          | archive GNU zip  gz,gzip
  text/html                 | HTML   htm,html
  text/plain                | texte sans mise en forme   txt,g,h,c,cc,hh,m,f90
  text/richtext             | texte enrichis   rtx
  text/tab-separated-value  | texte avec séparation des valeurs  tsv
  text/x-setext             | texte Struct   etx
  video/mpeg                | Vidéos MPEG   mpeg,mpg,mpe
  video/quicktime           | Vidéos QuickTime  qt,mov
  video/msvideo             | Vidéos Microsoft Windows  avi
  video/x-sgi-movie         | Vidéos MoviePlayer  movie
Note: any number of attachments may be added to the mail, but the size limit available for a single attachment is currently set at 100MB. Most servers and clients do not have the capacity to handle attachments of that size, therefore it is advised that each attachment be kept to a reasonable size

Example:

  InitNetwork()

  If CreateMail(0, "test@purebasic.com", "Hello")
    If AddMailAttachment(0, "Attachment 1", OpenFileRequester("Choose an attachment", "", "", 0))
      Debug "Attachment correctly added"
    Else
      Debug "Attachment failed"
    EndIf
  EndIf

Supported OS

All

Mail Index - AddMailAttachmentData() ->