001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.camel.component.mail;
018
019 /**
020 * Resolver to determine Content-Type for file attachments.
021 * <p/>
022 * Strategy introduced to work around mail providers having problems with this such as geronimo mail jars.
023 * <p/>
024 * Note using SUN mail jar have no problem with resolving Content-Type based on file attachments. This resolver
025 * is thus only needed to work around mail providers having bugs or when you a new mime type is unknown by the
026 * mail provider allowing you to determine it.
027 *
028 * @version $Revision: 12812 $
029 */
030 public interface ContentTypeResolver {
031
032 /**
033 * Resolves the mime content-type based on the attachment file name.
034 * <p/>
035 * Return <tt>null</tt> if you cannot resolve a content type or want to rely on the mail provider
036 * to resolve it for you.
037 * <p/>
038 * The returned value should only be the mime part of the ContentType header, for example:
039 * <tt>image/jpeg</tt> should be returned. Camel will add the remaining <tt>; name=FILENAME</tt>.
040 *
041 * @param fileName the attachment file name
042 * @return the Content-Type or <tt>null</tt> to rely on the mail provider
043 */
044 String resolveContentType(String fileName);
045 }