All Downloads are FREE. Search and download functionalities are using the official Maven repository.

system.net.mail.MailMessage Maven / Gradle / Ivy

/*
 *  MIT License
 *
 *  Copyright (c) 2023 MASES s.r.l.
 *
 *  Permission is hereby granted, free of charge, to any person obtaining a copy
 *  of this software and associated documentation files (the "Software"), to deal
 *  in the Software without restriction, including without limitation the rights
 *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *  copies of the Software, and to permit persons to whom the Software is
 *  furnished to do so, subject to the following conditions:
 *
 *  The above copyright notice and this permission notice shall be included in all
 *  copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 *  SOFTWARE.
 */

/**************************************************************************************
 * 
 *      This code was generated from a template using JCOReflector
 * 
 *      Manual changes to this file may cause unexpected behavior in your application.
 *      Manual changes to this file will be overwritten if the code is regenerated.
 * 
 *************************************************************************************/

package system.net.mail;

import org.mases.jcobridge.*;
import org.mases.jcobridge.netreflection.*;
import java.util.ArrayList;

// Import section
import system.net.mail.MailAddress;
import system.collections.specialized.NameValueCollection;
import system.net.mail.AlternateViewCollection;
import system.net.mail.AttachmentCollection;
import system.net.mail.DeliveryNotificationOptions;
import system.net.mail.MailAddressCollection;
import system.net.mail.MailPriority;
import system.net.mime.TransferEncoding;
import system.text.Encoding;


/**
 * The base .NET class managing System.Net.Mail.MailMessage, System.Net.Mail, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51.
 * 

* * .NET documentation at https://docs.microsoft.com/en-us/dotnet/api/System.Net.Mail.MailMessage *

* * Powered by JCOBridge: more info at https://www.jcobridge.com */ public class MailMessage extends NetObject implements AutoCloseable { /** * Fully assembly qualified name: System.Net.Mail, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 */ public static final String assemblyFullName = "System.Net.Mail, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"; /** * Assembly name: System.Net.Mail */ public static final String assemblyShortName = "System.Net.Mail"; /** * Qualified class name: System.Net.Mail.MailMessage */ public static final String className = "System.Net.Mail.MailMessage"; static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName); /** * The type managed from JCOBridge. See {@link JCType} */ public static JCType classType = createType(); static JCEnum enumInstance = null; JCObject classInstance = null; static JCType createType() { try { String classToCreate = className + ", " + (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); if (JCOReflector.getDebug()) JCOReflector.writeLog("Creating %s", classToCreate); JCType typeCreated = bridge.GetType(classToCreate); if (JCOReflector.getDebug()) JCOReflector.writeLog("Created: %s", (typeCreated != null) ? typeCreated.toString() : "Returned null value"); return typeCreated; } catch (JCException e) { JCOReflector.writeLog(e); return null; } } void addReference(String ref) throws Throwable { try { bridge.AddReference(ref); } catch (JCNativeException jcne) { throw translateException(jcne); } } /** * Internal constructor. Use with caution */ public MailMessage(java.lang.Object instance) throws Throwable { super(instance); if (instance instanceof JCObject) { classInstance = (JCObject) instance; } else throw new Exception("Cannot manage object, it is not a JCObject"); } public String getJCOAssemblyName() { return assemblyFullName; } public String getJCOClassName() { return className; } public String getJCOObjectName() { return className + ", " + (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); } public java.lang.Object getJCOInstance() { return classInstance; } public void setJCOInstance(JCObject instance) { classInstance = instance; super.setJCOInstance(classInstance); } public JCType getJCOType() { return classType; } /** * Try to cast the {@link IJCOBridgeReflected} instance into {@link MailMessage}, a cast assert is made to check if types are compatible. * @param from {@link IJCOBridgeReflected} instance to be casted * @return {@link MailMessage} instance * @throws java.lang.Throwable in case of error during cast operation */ public static MailMessage cast(IJCOBridgeReflected from) throws Throwable { NetType.AssertCast(classType, from); return new MailMessage(from.getJCOInstance()); } // Constructors section public MailMessage() throws Throwable, system.PlatformNotSupportedException, system.IndexOutOfRangeException, system.InvalidOperationException, system.ArgumentNullException, system.ArgumentException, system.diagnostics.tracing.EventSourceException, system.OutOfMemoryException, system.ArgumentOutOfRangeException { try { // add reference to assemblyName.dll file addReference(JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public MailMessage(MailAddress from, MailAddress to) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.IndexOutOfRangeException, system.NotSupportedException, system.globalization.CultureNotFoundException, system.ObjectDisposedException { try { // add reference to assemblyName.dll file addReference(JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject(from == null ? null : from.getJCOInstance(), to == null ? null : to.getJCOInstance())); } catch (JCNativeException jcne) { throw translateException(jcne); } } public MailMessage(java.lang.String from, java.lang.String to, java.lang.String subject, java.lang.String body) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.IndexOutOfRangeException, system.NotSupportedException, system.ObjectDisposedException, system.RankException, system.FormatException, system.OutOfMemoryException, system.diagnostics.tracing.EventSourceException { try { // add reference to assemblyName.dll file addReference(JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject(from, to, subject, body)); } catch (JCNativeException jcne) { throw translateException(jcne); } } public MailMessage(java.lang.String from, java.lang.String to) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.IndexOutOfRangeException, system.NotSupportedException, system.globalization.CultureNotFoundException, system.ObjectDisposedException, system.FormatException, system.OutOfMemoryException, system.diagnostics.tracing.EventSourceException { try { // add reference to assemblyName.dll file addReference(JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject(from, to)); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Methods section public void Dispose() throws Throwable, system.ArgumentNullException, system.NotSupportedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("Dispose"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void close() throws Exception { try { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("Dispose"); } catch (JCNativeException jcne) { throw translateException(jcne); } } catch (Throwable t) { throw new Exception(t); } } // Properties section public boolean getIsBodyHtml() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Get("IsBodyHtml"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setIsBodyHtml(boolean IsBodyHtml) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("IsBodyHtml", IsBodyHtml); } catch (JCNativeException jcne) { throw translateException(jcne); } } public NameValueCollection getHeaders() throws Throwable, system.ArgumentOutOfRangeException, system.ArgumentException, system.IndexOutOfRangeException, system.PlatformNotSupportedException, system.InvalidOperationException, system.ArgumentNullException, system.diagnostics.tracing.EventSourceException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("Headers"); return new NameValueCollection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public AlternateViewCollection getAlternateViews() throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.IndexOutOfRangeException, system.NotSupportedException, system.globalization.CultureNotFoundException, system.ObjectDisposedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("AlternateViews"); return new AlternateViewCollection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public AttachmentCollection getAttachments() throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.IndexOutOfRangeException, system.NotSupportedException, system.globalization.CultureNotFoundException, system.ObjectDisposedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("Attachments"); return new AttachmentCollection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public DeliveryNotificationOptions getDeliveryNotificationOptions() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("DeliveryNotificationOptions"); return new DeliveryNotificationOptions(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setDeliveryNotificationOptions(DeliveryNotificationOptions DeliveryNotificationOptions) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.IndexOutOfRangeException, system.NotSupportedException, system.globalization.CultureNotFoundException, system.ObjectDisposedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("DeliveryNotificationOptions", DeliveryNotificationOptions == null ? null : DeliveryNotificationOptions.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public MailAddress getFrom() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("From"); return new MailAddress(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setFrom(MailAddress From) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.IndexOutOfRangeException, system.NotSupportedException, system.globalization.CultureNotFoundException, system.ObjectDisposedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("From", From == null ? null : From.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public MailAddress getReplyTo() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("ReplyTo"); return new MailAddress(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setReplyTo(MailAddress ReplyTo) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("ReplyTo", ReplyTo == null ? null : ReplyTo.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public MailAddress getSender() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("Sender"); return new MailAddress(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setSender(MailAddress Sender) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("Sender", Sender == null ? null : Sender.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public MailAddressCollection getBcc() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("Bcc"); return new MailAddressCollection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public MailAddressCollection getCC() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("CC"); return new MailAddressCollection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public MailAddressCollection getReplyToList() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("ReplyToList"); return new MailAddressCollection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public MailAddressCollection getTo() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("To"); return new MailAddressCollection(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public MailPriority getPriority() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("Priority"); return new MailPriority(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setPriority(MailPriority Priority) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("Priority", Priority == null ? null : Priority.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public TransferEncoding getBodyTransferEncoding() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("BodyTransferEncoding"); return new TransferEncoding(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setBodyTransferEncoding(TransferEncoding BodyTransferEncoding) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("BodyTransferEncoding", BodyTransferEncoding == null ? null : BodyTransferEncoding.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public java.lang.String getBody() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (java.lang.String)classInstance.Get("Body"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setBody(java.lang.String Body) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.IndexOutOfRangeException, system.NotSupportedException, system.ObjectDisposedException, system.RankException, system.FormatException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("Body", Body); } catch (JCNativeException jcne) { throw translateException(jcne); } } public java.lang.String getSubject() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (java.lang.String)classInstance.Get("Subject"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setSubject(java.lang.String Subject) throws Throwable, system.PlatformNotSupportedException, system.ArgumentOutOfRangeException, system.ArgumentException, system.IndexOutOfRangeException, system.InvalidOperationException, system.ArgumentNullException, system.NotSupportedException, system.globalization.CultureNotFoundException, system.ObjectDisposedException, system.OverflowException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("Subject", Subject); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Encoding getBodyEncoding() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("BodyEncoding"); return new Encoding(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setBodyEncoding(Encoding BodyEncoding) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("BodyEncoding", BodyEncoding == null ? null : BodyEncoding.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Encoding getHeadersEncoding() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("HeadersEncoding"); return new Encoding(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setHeadersEncoding(Encoding HeadersEncoding) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("HeadersEncoding", HeadersEncoding == null ? null : HeadersEncoding.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Encoding getSubjectEncoding() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("SubjectEncoding"); return new Encoding(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void setSubjectEncoding(Encoding SubjectEncoding) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Set("SubjectEncoding", SubjectEncoding == null ? null : SubjectEncoding.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Instance Events section }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy