473,387 Members | 1,365 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to send hidden web-link by e-mail via MS Access

20
In my Access database I have a table with 2 fields: DOCNAME (Text) and WEBLINK (Hyperlink).

I have a VBA code for sending any data from this table by e-mail using CDO.Message function.

I can send web-links from WEBLINK field, but I need to hide it and instead the actual link to send the data from DOCNAME field.

For example, I fill the DOCNAME as “Contract” and WEBLINK as “http: //DomainName.com/Contract.pdf” (actual link to the document). Using the following code (part):
Expand|Select|Wrap|Line Numbers
  1. objMessage.TextBody = objMessage.TextBody & Split(rst![WEBLINK], "#")(2)
my recipient gets a link - http: //DomainName.com/Contract.pdf”
but how to hide it behind the clickable link “Contract” instead, or to send clickable link with the name of document from DOCNAME field.
Thanks
Feb 4 '16 #1
7 1538
jforbes
1,107 Expert 1GB
I think as long as your email format is HTML, you can supply an <a> Tag with a HREF Attribute:
Expand|Select|Wrap|Line Numbers
  1. <a href="url">link text</a> 
More info: http://www.w3schools.com/html/html_links.asp

So your code could look something like:
Expand|Select|Wrap|Line Numbers
  1. objMessage.TextBody = objMessage.TextBody & "<a href=""" & Split(rst![WEBLINK], "#")(2) & """>" & Split(rst![WEBLINK], "#")(1) & "</a>" 
that is if Split(rst![WEBLINK], "#")(1) contained the text you would like to display to the recipient.
Feb 4 '16 #2
CostasM
20
Thanks, jforbes,
I've changed the code as per your proposal, but now get the line
as below
<a href="">http://DomainName.com/Contract.pdf</a>
in plain text format, not clickable
Feb 4 '16 #3
jforbes
1,107 Expert 1GB
I've not developed code for emails in quite sometime, so I'm not an expert on it.

It looks like your getting an email with plain text or the text is being added to the email body as plain text. First thing I would do is make sure you are sending an email that is HTML. On the Email as it's being sent, or if you try to forward it, click on the Options Tab and you can see what the format is currently set to (Plain Text, HTML, Rich Text). If it's not HTML, then there is something that needs to be done to create the email in HTML.

If it is HTML, then you may want to try to use objMessage.HTMLBody instead of objMessage.TextBody. I only know this by looking at:http://www.rondebruin.nl/win/s1/cdo.htm
Feb 4 '16 #4
zmbd
5,501 Expert Mod 4TB
Keep in mind...

My company's email policy strips out all HTML and RichText formatting from external emails - this is a common practice due to the high level of spam, phishing, and malware attacks that use concealed URL-Links.

Personally, and for the same reason my IT-Staff does, at home I have my email client set to force to plan-text.

In either case, the hyperlink is converted to the URL so it may be a "wasted" effort to attempt this process.

In any case please read the following thread (and there are several more like this here at Bytes - use he search feature at the top of any page :-) )
To put a hyperlink from access in body e-mail outlook
Feb 4 '16 #5
CostasM
20
zmbd, thanks for reply, I know, some times it can be considered us spam, because of hidden URL links, but in my work I need to send a 10-15 attached files (documents) abt 5Mb total.

As a variant I think to send only links to these documents.
Documents stored in a cloudstorage but links stored in my database. Any idea how to realize it ?

After jforbes advice I've changed my code as follows :
Expand|Select|Wrap|Line Numbers
  1. objMessage.HTMLBody =  "<a href=" & Split(rst![WEBLINK], "#")(1) &">rst![DOCNAME]</a>"
It works, but my recepient get get the plain text (rst![DOCNAME])instead of actual value from DOCNAME field.

How to set value from the field to display ?
Feb 4 '16 #6
zmbd
5,501 Expert Mod 4TB
You should do the SPLIT() first, Follow the link in my prior post, there's a working example and explanation therein... and post#13 in that thread.
Feb 5 '16 #7
jforbes
1,107 Expert 1GB
For the .HTMLBody, you just want to create a string that fits into this pattern <a href="url">link text</a>. Where url is your URL and link text is the text to display. It looks like you can use single quotes in place of double quotes, so this <a href='url'>link text</a> should work also. Given this, I think this is more likely to work for you:
Expand|Select|Wrap|Line Numbers
  1. objMessage.HTMLBody =  "<a href='" & Split(rst![WEBLINK], "#")(1) &"'>" & rst![DOCNAME] & "</a>"
Z's suggestion of splitting the Strings first is a pretty good one, especially to debug later. In fact creating the whole string for .HTMLBody up first might be best. This example is overkill, but it might help you:
Expand|Select|Wrap|Line Numbers
  1. DIM sLink AS String
  2. DIM sDocName AS String
  3. DIM sBody AS String
  4.  
  5. sBody = ""
  6. sBody = sBody & "Here is your list of daily reports:  " & vbCRLF
  7.  
  8. ' Your OpenRecordset command
  9. ' Your For each OpenRecord
  10.     sLink = Split(rst![WEBLINK], "#")(1)
  11.     sDocName = NZ(rst![DOCNAME], sLink )
  12.  
  13.     ' Using replace is just another way to format the url
  14.     sBody = sBody & "<a href=""#Link#"">#DocName#</a>" & vbCRLF
  15.     sBody = Replace(sBody, "#Link#", sLink )
  16.     sBody = Replace(sBody, "#DocName#", sDocName )
  17. ' Move to NextRecord
  18.  
  19. sBody = sBody & "If you have any questions or wish to be " & vbCRLF
  20. sBody = sBody & "removed from this email blast, contact " & vbCRLF
  21. sBody = sBody & "CostasM at extension 1234" 
  22.  
  23. Debug.Print sBody 
  24. objMessage.HTMLBody = sBody 
  25.  
Feb 5 '16 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Akira | last post by:
Could someone tell me how to send outlook appointment email from asp page? I would like appointment email just like one outlook can send out. I tried to look for an answer for this, but it seems...
3
by: MLH | last post by:
How does one create a hidden module in Access 97? Why might one do so?
5
by: sam | last post by:
Do anyone know how to apply send datagrid via email? Any website for reference? Please advise.
6
by: h.khalid11 | last post by:
dear all, I have a list of files that the path of that files are stored in a list box, but now want to compress all these files stored in the list box and send it by email from outlook.(I am using...
0
by: Dave S | last post by:
I have a lot of forms on our web site that require the user to fill out information and submit it back to us. currently the information comes back as name value pair. The our employee's then has to...
9
by: JBuckner | last post by:
My macro uses the Send Object (VBA Item.Send) function to email a spreadsheet to an Outlook contact list. I want the function to be completely automatic but Outlook displays a security warning...
1
by: jadeverell | last post by:
Hi, I have a database that contains information of contracts / tenders and need to do the following task: * when a contract reaches its expiry date, i want to send an automated email to notify...
16
by: Ed Bitzer | last post by:
Trying to send groups of email with program using System.Net.Mail. I do not clear MailMessage but repeatedly loop changing only the Bcc entries. Works fine if all addresses are valid. As a simple...
8
by: jkbhanuprakashreddy | last post by:
Can some one help me how to send hidden variables in a URL?
1
by: Yousef Altaf | last post by:
I have this code (it's a form which will sign up new users and send them an email to active they account). <?php if(isset($_POST)) { $msg=""; $RFname =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.