473,698 Members | 2,149 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Send mail in c++ Query

5 New Member
Hi All ,

Can anyone help me reagrding MAPI send mail logic.


I am supposed to get the SMTP server name from an ini file and have to send a mail through this server name.
The syntax for getting the server name is :

mapird.lpszAddr ess = "<server name>";
Quotes are required here

it should fetch the server name from an ini file.this is wat i gave in the ini file:

SMTP Server Name=SMTP:yourn ame@domain.co.i n

I fetched the SMTP:yourname@d omain.co.in part from the ini file and stored it in a variable named str using VC++.Now i called this variable str like given below:

mapird.lpszAddr ess =str;

This gives me a error like this:

error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class std::basic_stri ng<char,struct std::char_trait s<char>,class std::allocator< char> >


Please help me what to do.Im writing a code to send a mail from VC++.also let me know if i can find any other code where i dont have to hardcode the server name.

Thanks a lot in advance
Apr 16 '07 #1
4 2188
weaknessforcats
9,208 Recognized Expert Moderator Expert
Do you #include <string> in your code??? If you are, I will need to see a piece of your code.

As to the hard-coded server name, use a conficuration file that you can create with a text editor and read the file to get the server path. There should be no hard-coded paths in youre program.
Apr 16 '07 #2
sai14
5 New Member
Do you #include <string> in your code??? If you are, I will need to see a piece of your code.

As to the hard-coded server name, use a conficuration file that you can create with a text editor and read the file to get the server path. There should be no hard-coded paths in youre program.


Hi..Thanks for replying.

I had already included #include <string> in my code and created a ini file to read.The follwing pasted is a part of the code:

MapiRecipDesc mapird;
mapird.ulReserv ed = 0;
mapird.ulRecipC lass = MAPI_TO;
mapird.lpszName = "Team";
mapird.lpszAddr ess = "SMTP:yourname@ domain.com";
mapird.ulEIDSiz e = 0;
mapird.lpEntryI D = NULL;


in this : mapird.lpszAddr ess = "SMTP:yourname@ domain.com"; I have to enter the SMTP name here.This is not flexible. so i created an .ini file and wrote the following in that.

[SERVICE]
SMTP Server Name=SMTP:yourn ame@domain.com

i fetched the SMTP Server name in the ini file by writing this c++ code.
if (c1==2)
{
str1=line.subst r(17,36)
}

It fetches SMPT:yourname@d omain.com and stores it in a variable str1. now how do i call the contents of the variable in this:
mapird.lpszAddr ess = str1; ??????? it gives error. and if i put Quotes it reads the contents in the quotes.
Apr 17 '07 #3
weaknessforcats
9,208 Recognized Expert Moderator Expert
I'm guessing that this:

mapird.lpszAddr ess = str1;

should really be:

mapird.lpszAddr ess = str1.c_str();

The c_str() method on string returns the contents off the string as a C string. In the Microsoft world an lpzAddress variable means "long pointer to a string terminated by zero", which is a C string.
Apr 17 '07 #4
sai14
5 New Member
I'm guessing that this:

mapird.lpszAddr ess = str1;

should really be:

mapird.lpszAddr ess = str1.c_str();

The c_str() method on string returns the contents off the string as a C string. In the Microsoft world an lpzAddress variable means "long pointer to a string terminated by zero", which is a C string.

Thanks a lot..it works....
Apr 25 '07 #5

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

Similar topics

2
3319
by: serendipity | last post by:
Hi, I'm not sure if this is possible as i've googled everywhere, but i have a select query that returns a customer record with their associated sales orders. I would like to automate a process which sends an email reminder to each customer in the database, that has outstanding orders. This email reminder should have the results of the query regarding their account. The table structure are as follows.
0
1883
by: cronept | last post by:
Hi, there, I have a form with 2 email buttons both with docmd.sendobject code. The 1st one send a report which is working properly. The 2nd one send a query in xls format which is always get an error message say" .... can't save the output data to the file you selected." I am very confused. it used to work properly. And now, sometimes it works, most time it doesn't work. I am using ACC2000, outlook express and Win XP. below are the 2...
2
1337
by: Albert | last post by:
I am trying to send a group mail to several recipients based on the selection from a query, I would prefer if the user was able to choose whom to include in the mail by e.g. checking a box next to every name on the list produced by the query. But it would be sufficient if the user could send a group mail to all in the list by pressing a button. Regards Albert
17
8789
by: DP | last post by:
hi, is there a way to send an e-mail to a customer, using ms access?? or some kind of automated mail merge, so the user only has to review the body, and click send? ive got a customer table, with a field called email address, where the customer can have an e mail address. is there a way to make access create one, using outlook express, or anything
10
24387
by: Mike Charney | last post by:
Is there a simple way to send SMTP email from Access VBA? Mike m charney at dunlap hospital dot org
17
7640
by: rdemyan | last post by:
My app creates a building report. My users have requested that I provide functionality to e-mail these "building reports" to building managers once a month. So assuming that I have the following table that lists a building manager's name, e-mail address and their building, is there a way that I can automate this to send these monthly e-mails from Outlook. Ideally this would be a click one button type of action:
1
1447
by: Viperoptic | last post by:
Hi There I am new at this and need some big HELP :-) I have a query that pulls 3 results, E.g. "CALL_ID" , "ETA" "E-mail addy" So I have 3 columns in my results of +/- 278 records and I need to send each one individually to an e-mail and sent it. I am trying to automate this and hoping to use a "Module" or something
2
3680
by: sufian | last post by:
<input type="image" id="imageField" class="btn" src="<?php bloginfo('template_url'); ?>/media/global/btn-go.gif" onclick = "sendRequestPost(document.getElementById('email1').value);" /> The function sendRequestPost() is in a file named header.php: function sendRequestPost(data) { // Open PHP script for requests MM_validateForm('email1','','RisEmail'); if (document.MM_returnValue) { <?php
3
6005
by: sachin shah | last post by:
hi all my query is how can i send mail by using sql server, i think by unsing xp_sendmail store procedure we can do this but my problem is what paramater to be pass to this store procedure if i want to send mail from my local machine to another user, bcos i am geeting this error msg in query analyzer... query:-EXEC master..xp_sendmail 'ss35934' (ss35934 is valid user name present into my local nerwork)
1
6561
by: sxwend | last post by:
I am trying to use the following post results (http://www.thescripts.com/forum/thread189759.html) and add another requirement. I need to send the results to just the email addresses that the query specifies for each record... Essentially this is a make shift Ordering Tool and I want to be able to notify the receiver of the order and its specifics. q_Order_Detail_4email consists of ,,, and Example: Hello@mail.com,956,Modem,1000,xyz123...
0
8674
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9157
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9028
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8895
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7728
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
2330
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.