Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Emails created via VB won't send from Outlook

Status
Not open for further replies.

Cannoli

Programmer
Apr 3, 2002
5
US
I'm having quite the frustrating time trying to figure out a particular
problem I'm having. I'll post the details and perhaps someone can assist me
before I go bald :)

I created an app that reads from a technical support database. It
determines cases closed for the day and sends the contact of a case an email
pointing them to a survey on my company's website. During development and
testing the emails seemed to work just fine. However, when I moved it to my
boss' machine it doesn't work exactly the way I would like it to. When
developing the app, I used VB 6.0 SP5 and the MAPI controls provided with
VB. Both machines are running Win XP. The only real difference is that the
development machine uses Outlook Express as the default mail client and my
boss' machine uses Outlook 2000. Both of them access a POP3 SMTP server.
MS Exchange is not being used.

The interesting thing is that the email gets created just fine and is sent
to the Outbox in Outlook to be sent, but an error occurs when trying to send
the email. Error Msg text is below.
Code:
The message could not be sent because one of the recipients was rejected by
the server.  Server Response: '550 5.1.1 <Client Name>... User unknown'.
(Account: 'mail.iwaynet.net', SMTP Server: 'mail.iwaynet.net', Error Number:
0x800ccc79).
The exact same code works for Outlook Express using the same SMTP server and
everything.

Following is the snippet of code used to create my email:
Code:
    With grsCasesToEmail
        strCaseNum = .Fields(CASENUM).Value
        strTechName = .Fields(TECHNAME).Value
        strCompany = .Fields(COMPANY).Value
        strContactName = .Fields(FIRSTNAME).Value & &quot; &quot; & .Fields(LASTNAME).Value
        strEmail = .Fields(EMAIL).Value & &quot;&quot;
        strDescription = .Fields(DESCR).Value
        
    End With
    
    
    With mpmMessage
        'Start composing message
        .Compose
        
        'Address Message
        .RecipDisplayName = strContactName
        .RecipAddress = strEmail
        
        'Subject of Message
        .MsgSubject = &quot;Customer Satisfaction Survey&quot;
        .MsgNoteText = strMsgText
        
        .Send False
    End With
[\code]
 
Try this FAQ
faq222-179 Craig, mailto:sander@cogeco.ca

&quot;Procrastination is the art of keeping up with yesterday.&quot;

I hope my post was helpful!!!
 
Thank you for the FAQ info. I briefly looked through it and it seems pretty straightforward, I'll review it more in depth during my lunch or something :)

I still have a question though. Shouldn't the MAPI controls work as well? Am I not initializing something correctly, a property I'm overlooking?

Thanks again for the assistance!
 
Yes but they won't give you access to some of the better functions that you would get the other way. Like being able to access the address book. I would always suggest using a DLL over an OCX in any case. Craig, mailto:sander@cogeco.ca

&quot;Procrastination is the art of keeping up with yesterday.&quot;

I hope my post was helpful!!!
 
After some trial and error I figured out my problem and thought I would post my findings.

It was apparently a problem with the Recipient Name being different than the Recipient Email Address. It Outlook Express 6 this was not an issue and the emails sent out fine. A different story for Outlook 2000. When I sent the Recipient Name to be the same as the Email Address emails sent out just fine without any problems.

Thanks Craig for your posts, your assistance was most appreciated.
 
Cannoli:

I know it is somewhat late in the day to revive this but I have two problems which this thread is relevant:

a) I also get emails bounced back in Outlook - but this happens even when the email address and recipient name are the same. When I look at the message in 'Sent Items' and double click on the recipient, I notice that the 'Email Type' is also set to the email address (when I would normally expect to see SMTP) but I cannot see any property that might affect this. Of course this may or may not be the root of the problem. My code is very similar to yours.

b) I notice that you specifically state:

&quot;The interesting thing is that the email gets created just fine and is sent to the Outbox in Outlook to be sent, but an error occurs when trying to send the email.&quot;

I cannot get anything to go into the Outbox (see also thread222-748186) - Ideally I'd like to do a .Save to there but the best I can manage is a .Save (to InBox) or .Send (to sent items) plus annoying virus warning for each message (which is discussed in other threads and FAQ).


I'd appreciate any input you may be able to give.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top