Solved

Sending Mail alternatives

Posted on 2004-09-03
10
198 Views
Last Modified: 2010-05-02
Hi I am in charge of a software application that needs to send and receive emails containing data.

The program gives two alternatives for mail smtp (via easymail objects) and MAPI.

The problem that I have is that for the easymail objects to work relaying needs to be turned on for authenicated users. Some of my customers are not willing to do this. For this reason with have a MAPI option. The problem that I have is that with MAPI I cannot send mail from anyone but the defualt profile. I have looked onto threads here and none of them appears to have an answer that just appear to fizzle out.

What I need is either a means of sending mail via mapi which is not the default profile or an alternate means that does not need relaying turned on. My mapi code is as follows.

Sub sendMail(User As String)
        'Use MAPI
        With MAPISession1
            .NewSession = True
            .UserName = User 'this is the outlook profile
            '.Password = passwrord
            .DownLoadMail = False
            .LogonUI = True
            .SignOn
            MAPIMessages1.SessionID = .SessionID
        End With
        With MAPIMessages1
            .Compose
            .RecipType = mapToList
            .RecipAddress = "zzzzzzzzz@hotmail.com"
               
            .MsgNoteText = User & " " & CStr(Now())
            .MsgSubject = "Electronic Filing " & User
           
            .ResolveName
            .Send False
        End With
        'MainMessage "Disconnecting from Mail Server"
        MAPISession1.SignOff
End Sub

I am testing this on a windows 2000 machine, using mail accounts that are remote hosted via fasthosts. I have set outlook as my default mail client. I also have outlook express and Lotus Notes installed.

Any help would be greatly appreciated.
0
Comment
Question by:MrPan
10 Comments
 
LVL 8

Expert Comment

by:bukko
ID: 11971928
Have you tried sending using CDONTS?
0
 
LVL 8

Expert Comment

by:bukko
ID: 11971944
0
 
LVL 2

Author Comment

by:MrPan
ID: 11972107
Thanks for the response but there is nothing on the thread that answers my questions.

CDONTS still needs relaying and it is worse then my easymail objects as it needs unauthenticated relaying. I have not tried this but read it on your link

The links on MAPI do not offer anything either. Any other suggestions.

The solution needs to be generic to work for 500+ customers regardless of their email systems.
0
 
LVL 69

Expert Comment

by:Éric Moreau
ID: 11972136
You can use http://www.freevbcode.com/ShowCode.asp?ID=109 with a SMTP server that allows realying.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 18

Expert Comment

by:JR2003
ID: 11972144
Can't you set the .username property to set the user you want to send the mail from?
0
 
LVL 2

Author Comment

by:MrPan
ID: 11972297
I set it to different mail profiles but when I go into outlook the mail is waiting in my outbox the from address is blank, if i hit send receive the mail is sent from my default profile.
0
 
LVL 2

Author Comment

by:MrPan
ID: 11972458
emoreau

The problem is that the mail has to come from the customer and  is being sent to a government department. It is an electronic form of data transfer.

I have been down the mail servers that allow relaying in the past, which works fine until they are blacklisted.

I was suprised the code worked without any passwords, I assume some servers may treat this as spam\relaying.



0
 
LVL 2

Author Comment

by:MrPan
ID: 12356144
I have found the answer myself.

My code works if you use profiles within the mail. YOu need to turn on profiles in Outlook. Outlook express will only send from the default account.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12574127
Closed, 500 points refunded.

modulo
Community Support Moderator
Experts Exchange
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now