+ Reply to Thread
Results 1 to 2 of 2

Sending mail with CDO through a remote SMTP server - problem with Reply To address

  1. #1
    Registered User
    Join Date
    09-19-2012
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2007
    Posts
    10

    Sending mail with CDO through a remote SMTP server - problem with Reply To address

    I want to send emails from VBA using the CDO functionality. I have used the method described by Ron De Bruin successfully in the past but only using my local SMTP server. I now need to do the same with a remote server, such as Gmail.

    I found something potentially suitable in the ever-informative Ron de Bruin's downloaded examples (http://www.rondebruin.nl/files/CDO_Example_Code.zip) which handily gives sample code for using with Gmail. This works, and emails do get sent and are received. However, the sticking point for me is what goes into the From (or reply-to) field in the delivered email. The comments where he says you can use the .ReplyTo parameter before the .Send seem appropriate. Here they are:

    ' Note: The reply address is not working if you use this Gmail example
    ' It will use your Gmail address automatic. But you can add this line
    ' to change the reply address .ReplyTo = "

    Sorry Ron, this doesn't work (at least for me). Here's my simplified and anonymousised code, which is virtually identical to RdB's code except I had to user port 465:
    Code:

    Please Login or Register  to view this content.
    The resulting email has the name given in the .From parameter ("replytoname" here, and can be Mickey Mouse or any text string you want) but the associated email address is the Gmail address given in the CDO parm 'sendusername'. i.e. "replytoname@anydomain.com" is totally ignored everywhere. Same if it's set in the CDO parm "senduserreplyemailaddress" (another potential solution to this that doesn't work). A 'Reply' to this email will go to the Gmail address, not to the sender's address. NOT what I want!

    I've googled this five ways from Sunday with no solution found and I'm out of ideas. Is there something in my PC's setup that might be preventing this working? I have Windows 7 Home and Office 2007.

    I use Windows Live for my normal email client (Outlook is not installed), but I'm writing this application for a friend who only uses Hotmail and also has no Outlook. He runs W7 and Office 2010. He may or may not have Windows Live installed but in any case he does not use it and it will have no accounts defined and so cannot use a local SMTP server. I'm using my own Gmail account (which I only use on my iPad, and rarely there) as the remote server for all this but if it doesn't work for me is it ever going to work for him? I need that return address to be his Hotmail address as he *will* be expecting replies. In this testing phase I'm using my own O2 account in its place, not that it matters a jot what that address is as it's ignored anyway.

    Help. Please. I posted this on another well-known Excel help forum but it received no responses at all. I'm hoping that this post might reach a different set of experts who will be able to shed the light. Or at least make some suggestions. Anyone know if Mr De Bruin is receptive to random questions directly from strangers?

    Regards,

    Bill

  2. #2
    Registered User
    Join Date
    09-19-2012
    Location
    Edinburgh, Scotland
    MS-Off Ver
    2007
    Posts
    10

    Re: Sending mail with CDO through a remote SMTP server - problem with Reply To address

    OK. Fixed it. I have to admit to a certain amount of redness in the facial area.

    I didn't go far enough in the testing of the received email. The displayed heading in my Windows Mail Inbox of was of the form "replytoname (gmailuser@gmail.com)" and in my innocence I believed that email address to be the Reply To address. I never actually tried to do a reply to it. When I did that today, more out of frustration than serious testing, lo and behold it provided the correct email address in the To field. i.e. replytoname@anydomain.com from my code above.

    Case closed.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

X vBulletin 4.1.8 Debug Information

  • Page Generation 0.05984 seconds
  • Memory Usage 8,863KB
  • Queries Executed 14 (?)
More Information
Template Usage (32):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (1)footer
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (2)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (4)navbar_noticebit
  • (6)option
  • (2)postbit_legacy
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (4)showthread_bookmarksite
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper
  • (1)vbseo_linkbackmenu_entry 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (39):
  • ./vbseo.php
  • ./env.php
  • ./vbseo/includes/functions_vbseo.php
  • ./vbseo/includes/functions_vbseo_pre.php
  • ./vbseo/includes/functions_vbseo_url.php
  • ./vbseo/includes/functions_vbseo_createurl.php
  • ./vbseo/includes/functions_vbseo_db.php
  • ./vbseo/includes/functions_vbseo_vb.php
  • ./vbseo/includes/functions_vbseo_seo.php
  • ./vbseo/includes/functions_vbseo_misc.php
  • ./vbseo/includes/functions_vbseo_crr.php
  • ./vbseo/includes/functions_vbseo_cache.php
  • ./vbseo/includes/functions_vbseo_hook.php
  • ./vbseo/includes/functions_vbseo_startup.php
  • ./includes/config.php
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/functions.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/functions_cforum.php
  • ./includes/functions_facebook.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (46):
  • init_startup
  • friendlyurl_resolve_class
  • database_pre_fetch_array
  • database_post_fetch_array
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • fetch_musername
  • cache_templates
  • template_register_var
  • parse_templates
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • reputation_image
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • showthread_bookmarkbit
  • navbits
  • navbits_complete
  • showthread_complete


Search Engine Friendly URLs by vBSEO 3.6.0 RC 1