Solved

CDO Issue with gmail smtp

Posted on 2013-02-02
14
663 Views
Last Modified: 2014-11-12
I recently moved my cdo sys web email process to my gmail servers.  Now when someone sends me an email from the website it comes "From" my domain name, not the sender's email address.  This did not happen when I was using a different server.  How can I fix that?

Here is my code:
		If sHackMsg = vbNullString Then sEmail = CleanInput(Trim(Request.Form.Item("email")))
		If sHackMsg = vbNullString Then sSubject = CleanInput(Trim(Request.Form.Item("subject")))
		If sHackMsg = vbNullString Then sBody = CleanInput(Trim(Request.Form.Item("body")))
		
		If sHackMsg = vbNullString Then
			sMsg = "A Message from GSE Contact Us" & vbCrLf & vbCrLf
			sMsg = sMsg & "From: " & sYourName & vbCrLf
			sMsg = sMsg & "Email Address: " & sEmail & vbCrLf & vbCrLf
			sMsg = sMsg & "Message: " &vbCrLf 
			sMsg = sMsg & sBody

			Set cdoMessage = CreateObject("CDO.Message")
			With cdoMessage
				Set .Configuration = cdoConfig
				.To = "me@mydomain.com"
				.From = sEmail
				.Subject = sSubject
				.TextBody = sMsg
				.Send
			End With
			Set cdoMessage = Nothing
			
			bMsgSent = True

Open in new window

0
Comment
Question by:Bob Schneider
  • 5
  • 5
  • 4
14 Comments
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 100 total points
ID: 38847006
You probably just need to change

.From = sEmail

to

.from =   ""&sEmail&" <"&sEmail&">"
0
 
LVL 30

Assisted Solution

by:Wayne Barron
Wayne Barron earned 400 total points
ID: 38847258
Yep, that is by Design, GMail is setup not to allow SPAM, and this is their way of combating it.
So, You will need to add in the email address from the sender, to the top of the email body itself, this way, you will then be able to copy and paste the email address into a reply back message.
Yes, very annoying, but, we have to deal with it, right? right.

Have a good one.
Carrzkiss
0
 

Author Comment

by:Bob Schneider
ID: 38847552
padas, I tried what you suggested but to no avail.  carrzkiss, are you serious???  SOB that is a HUGE inconvenience for my site users.

Can you think of any  workarounds??
0
 
LVL 30

Accepted Solution

by:
Wayne Barron earned 400 total points
ID: 38847578
There is no workaround for this.
I read this one from Google help site.
So, yes, this sucks, however, there is NO way around it.
It is not to stop SPAM, it is to stop PHISHING.
Actually, there is a way around it, you have to find another mail server to host your mail from.

It is about like the Hosting Provider that I am currently with, has their mail server set up to send mail from 127.0.0.1
So, everything you send out, gets marked as SPAM.
It is there way of stopping SPAM.
My opinion, it is up to the site owner, not the hosting provider, on stopping SPAM.

I have been with Google for 2 years now, running the mail for my site(s).
And it is a pain, however, it is the only option I have right now.

Take Care
Carrzkiss
0
 

Author Closing Comment

by:Bob Schneider
ID: 38847592
That REALLY sucks but I appreciate the insight.
0
 
LVL 30

Expert Comment

by:Wayne Barron
ID: 38847622
yep...
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 38847677
I think I am confused.  

You have a web server, an old email server (may have been your web server) and now email through gmail.

You have a form on your web server that sends email to  you through your gmail.

You want the "from" to look like it is "from" the sender.  The "from" can be anything you want.   You may have to do MySendersEm@ail.com <myactual@email.com> at least that way you can see who sent it in your email.  But I would also put the info in your body.  

What will help you further is using authentication which you are not doing.  I use the below code as a base. Just note the port you will want to change for gmail can be the encrypted port I think is 465.

Using gmail for this kind of thing has limitations.  If you send a lot of mail like this, I would use a 3rd party smtp service which is what I do.  It does cost some dough but they take care of whitelisting and if you do get marked as spam, it is the ip for the smtp service,  not your actual email.   If you are just sending small amounts of one off emails to yourself, you are probably ok.    I have clients with paid gapps for business and I still use 3rd party smtp service.

But as far as just being able to see who sent you the mail from the form info, just put in the name portion and keep your email in the carrots.  name <myemail>




Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).

Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.From = """mysenders name"" <me@my.com>"
objMessage.To = "me@mydomain"
objMessage.TextBody = "This is some sample message text.." & vbCRLF & "It was sent using SMTP authentication."

'==This section provides the configuration information for the remote SMTP server.

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.your.com"

'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic

'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "youruserid"

'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "yourpassword"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send
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.

 

Author Comment

by:Bob Schneider
ID: 38847786
Let me be a little more clear:  I have a web "service" that cross-country coaches use to manage their teams.  It is www.etraxc.com/.  If a coach wants to send an email to their entire team they can do that through a form on the site.  I use cdo sys to do that, which requires an smtp server.  Before I was using the smtp on a third party (secureconnect.com) but I moved it to gmail.  

The upshot now is that when a coach sends an email to his team they can't simply reply to the email, they have to click on the coaches name and send a new email.  This is a huge inconvenience especially if they wanted to keep the email contents in the trail.

Does this help?
0
 
LVL 30

Expert Comment

by:Wayne Barron
ID: 38847800
Hey padas.

See, Gmail, when sending webform mail, will not put the senders email address in the "From" line, instead, it will pick up on the main senders email address, in this case, if the email address that is hard coded in the mail script.

GMail does it this way, to stop PHISHING, I am not really sure how it works like that, but that is how they have it setup.
So, you cannot code it, no matter what you do.
Trust me, i tried and tried and tried, my darnedest, and I could not come up with anything, then I started searching, and found out that GMail has it like that by design.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 38847887
That sounds right. I didn't get that the email was being sent out from a coach to somebody via his service.   Now that makes sense and I agree with what google is doing since they can not control what is happening.  You would need to either have your own mail server to do what you want or use a 3rd party smtp service.  I have been using sendgrid.    You can white label the outgoing accounts.
0
 

Author Comment

by:Bob Schneider
ID: 38847928
What is the cost for a third party such as sendgrid?
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 38847983
It depends on what you want. It starts out at $10 per month but the problem is that level does not include white listing for aol/comcast.  So the minimum is $80 per month for up to 100,000 emails.  So cheaper then the likes of constant contact.  You can have multiple sub accounts share one account although they would share the same IP. I think each additional IP is $20 or $30 per month.  Then just whitelabel each sub account http://sendgrid.com/docs/User_Guide/whitelabel_wizard.html.  I just will not send email from my server anymore.  Too much responsibility and work.  The auto email is more likely to be marked as spam especially if done from your server.  It's hard to find a shared web hosting service that will let you send out mail via the web server but you could get a cheap dedicated or cloud service just for sending out email and have 100% control.  It would end up costing you about the same per month except no limits.  But you would have to spend time getting and staying on ISP's white lists.  I stopped being cheap.  It doesn't pay.
0
 
LVL 30

Expert Comment

by:Wayne Barron
ID: 38848013
If you have the bandwidth coming into your home or office.
For less than $1,000.00, you can purchase a server that you can then install
A mail server onto.

I have an older 2gb server right now, that I run for my bulk mailing, of which I have not utilized yet, to many other projects...

The only issue about having your own server, is that you have to get in contact with all the ISP's, to get yourself white-listed. Like AOL.

I prefer to run my own servers, and am hoping that by the Summer, I will have my own servers for all my domains.

Have a good one.
Time for sleep.

Carrzkiss
0
 

Author Comment

by:Bob Schneider
ID: 38848565
You folks are the best.  Thanks for the good advice!!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Learn about cloud computing and its benefits for small business owners.
Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
This Micro Tutorial  demonstrates whether your site uses one subdomain or multiple subdomains, how to create full URLs from Google Analytics content reports. This procedure is called concatenation and can also be done with the CONCATENTATE function.…
This Micro Tutorial will demonstrate how to use comments in Google Docs. You will learn how to create, edit, and delete a comment.

744 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

13 Experts available now in Live!

Get 1:1 Help Now