Adds an attachment directly by content.

@param content the content of the attachment
@param filename the filename of the attachment
@return this builder
186918
public MultipartBuilder attachment(String content, String filename) {
        ByteArrayInputStream is = new ByteArrayInputStream(content.getBytes());
        return bodyPart(new StreamDataBodyPart(ATTACHMENT_NAME, is, filename));
    }
1114395
public MessageBuilder addAttachment(BufferedImage image, String fileName) {
        delegate.addAttachment(image, fileName);
        return this;
    }
732721
public function addAttachment(File $file, $fileName = '', $type = 'plain/text')
    {
        $this->message['attachments'][] = [
            'type'    => $type,
            'name'    => $fileName,
            'content' => base64_encode($file->getContents())
        ];

        return $this;
    }
1228221
@SuppressWarnings("unchecked")
  @NonNull public CMARichBlock addContent(@NonNull CMARichNode... content) {
    if (content == null) {
      throw new NullPointerException("content is null");
    }

    this.content.addAll(Arrays.asList(content));

    return this;
  }
630559
public void addContent(Content content) {
    Content newContent = new Content();
    newContent.setType(content.getType());
    newContent.setValue(content.getValue());
    this.content = addToList(newContent, this.content);
  }
392286
public function addAttachment(string $file, string $content = null, string $contentType = null): self
	{
		$this->message->addAttachment($file, $content, $contentType);
		return $this;
	}
1312905
public boolean add(String fileName) {
      writeLock.lock();
      try {
         return filenames.add(fileName);
      } finally {
         writeLock.unlock();
      }
   }
476191
public static Deployment of(final File content) {
        final DeploymentContent deploymentContent = DeploymentContent.of(Assert.checkNotNullParam("content", content).toPath());
        return new Deployment(deploymentContent, null);
    }
644571
def _create_related_attachment(self, filename, content, mimetype=None):
        
        attachment = super(EmailMultiRelated, self)._create_attachment(filename, content, mimetype)
        if filename:
            mimetype = attachment['Content-Type']
            del(attachment['Content-Type'])
            del(attachment['Content-Disposition'])
            attachment.add_header('Content-Disposition', 'inline', filename=filename)
            attachment.add_header('Content-Type', mimetype, name=filename)
            attachment.add_header('Content-ID', '<%s>' % filename)
        return attachment
929032
public function addAttachment($name, $MIMEType, $content)
    {
        if (isset($this->attachments[$name])) {
            throw new Exception("The attachment identified by '{$name}' has already been set.");
        } else {
            $this->attachments[$name] = array("type" => $MIMEType, "content" => $content);
            $this->hasAttachments = true;
        }
    }
109179
function Attachment(options) {
    this.fileName = options.fileName;
    this.contents = options.contents;
    this.filePath = options.filePath;
    this.streamSource = options.streamSource;
    this.contentType = options.contentType;
    this.cid = options.cid;
}
154230
public boolean addAttachment(Attachment attachment) {
    boolean isExist = false;
    for (Attachment a : attachmentList) {
      if (a.getLabel().equalsIgnoreCase(attachment.getLabel())) {
        isExist = true;
      }
    }
    if (!isExist) {
      return attachmentList.add(attachment);
    }
    return false;
  }
922162
public T addFile(String file) {
    checkNotNull(file, "file");
    builder.files.add(file);
    return self();
  }
173197
public void addAttachment(final String name, final DataSource filedata) {
		attachments.add(new AttachmentResource(name, filedata));
	}
819096
public static File writeFile(String filename, String content) {
        PrintWriter pw = null;
        try {
            pw = new PrintWriter(filename, FILE_ENCODING);
            pw.write(content);
            pw.flush();
        } catch (FileNotFoundException e) {
            throw new IllegalArgumentException("Unable to write to: " + filename, e);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        } finally {
            if (pw != null) {
                pw.close();
            }
        }
        return new File(filename);
    }
848894
public InputFile setMedia(InputStream mediaStream, String fileName) {
        this.newMediaStream = mediaStream;
        this.mediaName = fileName;
        this.attachName = "attach://" + fileName;
        this.isNew = true;
        return this;
    }
278943
public E attachment(byte[] attachment, String name) {
        attachments.put(name, attachment);
        return getThis();
    }