Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sending Mail alternatives

Posted on 2004-09-03
10
Medium Priority
?
206 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 70

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
 
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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses

688 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