Migrating one email domain to external server

our AD domain "domain1.com" users have @domain1.com, @domain2.com, and @domain3.com (this one is for testing usage) mailboxes/addresses on our internal Exchange 2010 14.01.0438.000 server.   All users are on the same domain regardless
of the email address they use.  mailboxes with @domain1.com as their primary smtp address are being migrated to an email service outside of our organization/domain but will still remain users on our domain.  For those users we'll be creating a new
profile in Outlook pointed at that new external mail server to switch over to on the cutover date while leaving the existing profile as is.  Following migration for a period of time we want  @domain1.com users to still be able revert to their current
Outlook profile and be able to get to our OWA in case any problems/inconsistencies occurred migrating contents to the new service. It's understood that sending/receiving mail would no longer work for them on the internal Exchange server, the point is just
that they could access the old contacts/calendar/notes/tasks/emails. 
My testing with migrating @domain3.com indicated that in order for domain2.com senders to be able to send mail to @domain1.com recipients after the cutover date and have the mail arrive at the external server instead of the internal server, the following
would have to be done:
-domain1.com removed from gatewayproxy attribute in recipient polices -
removal of gatewayProxy via ADSI
-domain1.com removed from exchange >> organization configuration >> hub transport >> accepted domains
-mx record pointing at external mail server added to internal dns server domain1.com zone
-domain1.com removed from smtp proxyAddresses attribute on each mailbox
It seems like there should be a way to achieve the result of getting the mail to the external server without modifying the proxyAddresses attributes so that the users could still get back into the old exchange server after cutover with their original address. 
any ideas?
Thanks

the steps to get [email protected] to [email protected] mail sent to external server are clear from testing and additional testing shows some option for still getting into the old mailboxes from clients/owa but not clear is how it could be done while leaving
domain1.com mailbox addresses intact on the old Exchange server and the AD user object 'mail' attribute intact as it was pre-cutover.  To expand and rephrase my original post, is there a way to make Exchange determine whether it should route domain1.com
mail internally vs externally via a global setting that would take priority over and cause to be ignored smtp proxyAddresses attributes on individual mailboxes so these don't have to be stripped/modified causing unwanted AD attribute alteration?
objective partially achieved -
AD object for [email protected] mailbox has the following attributes -
proxyAddresses =  SMTP:[email protected] (Exchange primary reply-to address) & smtp:[email protected]
'mail' attribute = [email protected]
if we change primary/reply SMTP in exchange to [email protected] and remove SMTP:[email protected], the result of internal mail sent to [email protected] going to the external server is accomplished but the 'mail' attribute in AD then changes to [email protected]
which is unwanted.  we still want 'mail' attribute left as is for these users since their email addresses are not changing.  access to mailbox contents on old exchange server via old [email protected]'s old outlook profile + OWA still work which
is good though. 
also found that adding a domain to organization configuration >> hub transport >> accepted domains as 'external relay' in addition to a send connector for the domain pointed at the MX for the external server still isn't enough to override/ignore
any proxyaddresses on the internal mailboxes.  mail willl still end up at the internal mailbox.

Similar Messages

  • Two email domain on 1 Server?

    Greetings-
    I am sure this has a simple answer.
    Customer owns for example www.exampleone.com and www.exampletwo.com.
    Tis easy enough to serve up web pages for both URL's pointed to client's ip.
    I cannot for the life of me figure out how or if I can configure mail to go to both. Mail works if sent to [email protected] but I cannot figure out how to get mail to go to [email protected]
    Thanks-
    -DaddyPaycheck

    You can run any amount of mail domains you like on a single server with a single IP. The limit is given by the cumulative message traffic and message scanning your hardware and bandwidth can deal with.
    You have to differentiate between "local domains/local host aliases" and "virtual domains". With the former a user will be shared across domains, the latter will give you different users even for the same name.
    [email protected] = [email protected]
    [email protected] NOT = [email protected]
    Which to pick depends on your needs.
    If you need instructions on how to set up virtual mail domains, download tutorial here: http://osx.topicdesk.com/downloads/

  • Change email domain delivery priority

    I have one email domain (DomainA) that I would like to have the highest priority for delivery, it's an internal domain so I can setup a specific smtproute with priority 0.  The issue is we send a lot of email to a lot of domains (DomainB,DomainC, DomainD) and the queue can build up.  But I want DomainA delivered as soon as the ironport received the email.  I've tried to add DomainB,DomainC, DomainD to smtp routes with 'usedns' but it will not keep a higher priority setting that is larger than 0.  So I'm not sure how I can make specific domains deliver quicker than the default domains.  Any suggestion would be appreciated.
    -Shawn

    Hello Shawn,
    there is a difference between the workqueue (messages in workqueue) and delivery queue (active recipients). SMTP Routes, Destination Controls etc. work on delivery indeed, however there is currently no prioritization you can set on the workqueue, do get messages from one sender processed faster than from others.  You can address this in a slightly different way though, for instance by setting up limits on receiving for all hosts but the ones you want to prioritize, to prevent that the workqueue is building up. A common setting used for this is the "Rate Limit for Envelope Senders" in the mail flow policies. Activating this will limit the rate of messages injected per sender address, for a given time frame (default is 60 minutes, but can be changed). You could activate this setting in all mail flow policies, except the one for the senders you want to prioritize, or, use the "address list" for excluding senders from this policy.
    Hope that helps,
    Regards, Andreas

  • Edge Transport Server Fails DNS Query When Emailing to one Specific Domain

    This issue occurs for the same domain across three different edge transport servers.
    All servers are Windows 2008 STD SP2, Exchange 2007 SP1 U9.  Emails are delivered using DNS connector from edge.  Emails to this one specific domain would sit in the retry queue with DNS query error until NDR was generated.  Connectivity Logging generated the following:
    2009-09-01T19:52:23.539Z,08CBEDE9198E2DC3,SMTP,subdomain.domain.com,>,DNS server returned ErrorRetry reported by 208.241.124.200
    2009-09-01T19:52:23.539Z,08CBEDE9198E2DC3,SMTP,subdomain.domain.com,-,The DNS query for 'DnsConnectorDelivery':'subdomain.domain.com':'cd771f71-77a3-4aca-b002-86f477816910' failed with error: ErrorRetry
    I changed the servers DNS settings to different servers with the same response.  Validated that manual MX lookups worked, and that I could telnet to any of the three MX records and deliver mail via telnet.
    I did a packet capture and received the following:
    12    32.280037    172.28.16.55    208.241.124.200    DNS    Standard query AAAA SMTPSERVER.subdomain.domain.com
    So what is happening is the Edge servers are only performing IP6 lookups, and throughout the log, only for subdomain.domain.com do they NOT perform a regular IP4 A record lookup.  I then went about disabling TCP/IP6 as per this article:
    http://technet.microsoft.com/en-us/network/cc987595.aspx
    this stated to do the following:
    Alternately, from the Windows XP or Windows Server 2003 desktop, click Start , point to Programs , point to Accessories , and then click Command Prompt . At the command prompt, type netsh interface ipv6 uninstall .
    To remove the IPv6 protocol for Windows XP with no service packs installed, do the following:
    Log on to the computer with a user account that has local administrator privileges.
    From the Windows XP desktop, click Start , point to Programs , point to Accessories , and then click Command Prompt .
    At the command prompt, type ipv6 uninstall .
    Unlike Windows XP and Windows Server 2003, IPv6 in Windows Vista and Windows Server 2008 cannot be uninstalled. However, you can disable IPv6 in Windows Vista and Windows Server 2008 by doing one of the following:
    In the Network Connections folder, obtain properties on all of your connections and adapters and clear the check box next to the Internet Protocol version 6 (TCP/IPv6) component in the list under This connection uses the following items .
    This method disables IPv6 on your LAN interfaces and connections, but does not disable IPv6 on tunnel interfaces or the IPv6 loopback interface.
    Add the following registry value (DWORD type) set to 0xFF:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\DisabledComponents
    This method disables IPv6 on all your LAN interfaces, connections, and tunnel interfaces but does not disable the IPv6 loopback interface. You must restart the computer for this registry value to take effect.
    I did the above, and still, the Edge Transport servers would only perform AAAA lookups, and messages would sit in the queue.
    As temporary workaround, created new send connector with the three available MX hosts as possible smarthosts for subdomain.domain.com, and this allowed email flow.
    I've tried disabling the TCPIP6, and still doesnt work.  Any suggestions?

    Hi Allen and Paul,
    we experience problems in receiving mails from senders with this Exchage server problem. When we are aware of the problem, we send them the above mentioned link and ask them to make adjustments. Then afterwards usually mail arrives without any problems.
    The problem for us is that it seems as if the problem grows. More and more mail does not arrive on our mailadresses (mine for example is [email protected]) And not all of the senders recieve notifications that mail cannot be delivered. As you can imagine
    this situation is unacceptable and damaging our customer relations.
    Is there anything WE can do? (apart from sending them the information to make adjustements in their Exchange servers...)
    I hope you can help us...
    Thanks in advance
    Leonard
    Hi Leonard,
    as stated below we where experiencing the same problem with one of our customers. Seeing that it's a DNS related problem we suggested to the customer to change or add an additional DNS service through i.e. dyndns.com. After adding the current DNS records
    to the new DNS service mail started coming in from every customer that had problems.
    So for your clients i would suggest a similar solution, it helped over here at least.
    Kind regards,
    Philipp

  • Migrating from 2003 domain/forest level to 2008R2 with all DC's at 2008R2 and 2 other Domain External and Forest Trusts

    Is there anything that needs to be done or considered when migrating from 2003 domain/forest level to 2008R2 with all DC's at 2008R2 with 2 other 2003 separate Domain incoming
    and outgoing Trusts, one Trust that is a Forest Trust and the other is an External Trust? Is there any chance or risks that doing this upgrade will break either one of these Trust relationships? Some of the user accounts with SID history have been migrated
    from both Domain Trusts to our domain. Any chance that this upgrade will break these relationships for users that are using SID history for access to folders and files in their old Domains? If so what can be done to protect these trusts and SID history, prior
    to moving the Domain to 2008R2

    Hi,   
    Based on my knowledge,
    the Upgrade of the function level do not affect the trust relationship.
    Besides, before you upgrade the Functional Level,
    verify that all DCs in the domain are, at a minimum, at the OS version to which you will raise the functional level.
    Once the Functional Level has been upgraded, new DCs on running on downlevel versions of Windows Server cannot be added to the domain or forest.
    For more information about function level, we can refer to following links:
    Understanding Active Directory Domain Services (AD DS) Functional Levels
    http://technet.microsoft.com/en-us/library/understanding-active-directory-functional-levels(v=ws.10).aspx
    What is the Impact of Upgrading the Domain or Forest Functional Level?
    http://blogs.technet.com/b/askds/archive/2011/06/14/what-is-the-impact-of-upgrading-the-domain-or-forest-functional-level.aspx
    Best Regards,
    Erin

  • Migrating existing email from 10.4 NON-server to 10.6 server, ~beginner

    I have been running a domain for many years off a stock Mac OS running plain 10.4, with a few third-party config aids. I want to move the whole domain to 10.6 Server, but my current question focuses on migrating emails. I fully expect to have to manually recreate all the user accounts (alternative ideas are welcome), but I want to maintain the entire email history for these accounts, as-is. (I use IMAP exclusively, so all the files reside on the server.)
    In my 10.4 system, inbox emails live in /var/mail, and anything else that's in a mail folder lives in ~/Library/Mail/IMAP/{folders} . Here are some things I don't know:
    1) How (if at all) the 10.6 implementation of mail services differs regarding location/format of email files. Also, if there's any difference in the functionality of /etc/aliases.
    2) How to transfer the files from old server to the new one. This is a "one box" domain. Since the domain's DNS (and web, ftp, firewall, etc.) is hosted on the same machine, I'm not sure how I could have them live on the internet at the same time (though obviously I can have one machine acting purely as a client on my network). I do have an extra static IP available as well.
    3) How I might minimize downtime, and park in the ether any inbound email messages to my domain while I make the transition and debug it.
    I'm hesitant to POP the messages off the server into a client, and POP them back on to the new server, for fear of losing the original time stamps (which are crucial), plus it'd be a big hassle. On the other hand, I don't know what havoc would come from trying to replace or splice in my existing email server files onto the new machine.
    I have successfully configured a different domain on 10.6 Server, though it was a PITA, and took several attempts. (Not looking forward to another DNS set up. And woe be to those who wish to change the initial IP number on a SLS machine - there are residual references that are unreachable even with the CLI tools.) So I'm not a total noob, but also I'm not a network admin wizard by any stretch.
    I'd welcome any helpful advice on this question, or generic strategies for porting an existing domain to 10.6 server. User files, permissions, web servers are pretty straightforward, though I'd also be curious if there's a SLS firewall configuration equivalent (in function and ease of setup) to standard OS X "internet sharing" preference, which I currently use (with two ethernet ports). Thanks so much.

    Thanks very much Jeff. The first sentence gets to the nut-meat of the issue (though I leave the question open for any additional comment).
    And I appreciate the links to migration tools. My recollection - perhaps wrong - is that the 10.6 migration tools only work for earlier versions of OS X Server, and not for the end-user OS (which is what I have now).
    My server has a half-dozen or so user accounts, with a total volume of <10 GB of email files - small. (There are also hundreds of email account aliases, which is why I asked about /etc/aliases functionality.)
    The concept of DNS is simple, but I always have a hard time telling if I've screwed up the configuration or a "failure" is just propagation latency of the domain/IP mapping - I don't have an intermediate DNS server/service between the domain registrar and my domain's server, which can make DNS config and testing quite frustrating.
    The rationale for NAT/DHCP has to do with internal network architecture and layered security for remote (e.g., VNC) access, but the whole story is not very interesting. I will take your point under advisement, though.

  • Issue in SQL-server migration to new domain

    Hello,
    I have a scenario, where i need to migrate SQL 2005 servers db's ( around 30, small ones) to new server in a new domain. Destinationserver is 2012 R2, running SQL2014
    Domains have trust between them, and users have already been migrated to new domain. Users are using the databases with NT authing from the new domain (new logins & users have been created to old sql-server).
    I have backed up db's from old server and restored them in new server. After that, i restored logins with following article's script:
    http://support.microsoft.com/kb/918992
    I cleaned from the login script logins that are not in use, change the domainname to new in CREATE LOGIN phase (for the users who did not have already login from new domain) and the script ran without errors.
    User Mappings are like they should be on logins, however, the user & schema names are indicating to old domain. If i try to change them, i receive error about SID mismatch. This affects also users, who have already had new logins for new domain, their
    usernames on mappings are also changed to old domain's username. What is causing this?

    Hi,
    Could you try the following to migrate the logins and check the result?
    1. You may drop all the windows login. Modify the script generated by sp_help_revlogin step and replace create login
    to drop login.
    2. Use the script generated by sp_help_revlogin step to create
    Logins. Modify login name to accommodate new domain name.
    3. Grant server level roles using the output from:
    Generate Server level role related info :
    SELECT 'EXEC sp_addsrvrolemember ''' +
    p.name + ''' , ''' + r.name + ''';'
    FROM
    sys.server_principals r
    INNER JOIN sys.server_role_members m ON r.principal_id = m.role_principal_id
    INNER JOIN sys.server_principals p ON
    p.principal_id = m.member_principal_id
    WHERE
    r.type ='R'
    Sample Output :-
    EXEC sp_addsrvrolemember 'sa' , 'sysadmin';
    4. Map the SIDS using below command for all DB by using ALTER USER. For example:
    ALTER USER [DomainA\UserA] with login = [DomainB\UserA]
    See:
    http://blogs.technet.com/b/mdegre/archive/2011/06/27/can-i-move-sql-server-to-another-domain.aspx
    Here some useful articles:
    http://www.databasejournal.com/features/mssql/article.php/3922256/Re-generating-SQL-Server-Logins.htm
    http://support.microsoft.com/kb/918992/en-us
    http://support.microsoft.com/kb/240872
    Thanks.
    Tracy Cai
    TechNet Community Support

  • Not receiving emails from one specific domain

    Hi,
    I'm having problems with not receiving emails from one specific domain @youmail.dk. It hasn't been an issue earlier, but I stopped receiving the emails late last year. For all I know this is the only domain there's a problem with - I don't have any problems with any other random domain.
    There is no rules or anything like that set up, so I have no idea what the problem could be... There's no "failure to deliver" notification send to the sender either.
    It doesn't matter if I check iCloud online, on my MacBook or iPhone...
    Can anyone help me?
    Nina.

    Comcast Security Assurance manages email system security and should be able to help you with this. Call them at 1-888-565-4329 (from http://constantguard.comcast.net/dedicated-support/). They will probably want to know the IP address(es) and/or host name(s) of the sending email server(s).
    The first-line reps at CSA are sometimes not so helpful. If so, be persistent, and keep at them until you get a satisfactory answer.

  • Allow External Server on Cloud to Relay Email

    Hi Exchange Server Expert,
    I have a query to ask. Currently my company has hosted a web server on the cloud with the public IP address. Since it is a web server, we will need to allow it to relay email via the Microsoft IIS to our exchange server. I have tried before for the internal
    server with private ip to relay email on the exchange server by creating a receive connector. however, I never try for the remote server with public ip address. we would like the remote server to relay email to both our internal email (accepted domain in exchange
    server) and also external recipients with the external domain.
    How am I suppose to perform this task?
    Thanks for your attention.
    Best Regards,
    Henry

    Hi Oliver,
    thanks again for your prompt response.
    I can't login to the web server as it is managed by vendor that configure the web server and we are only being allowed to access the web server via the public URL. basically, i don't know what is the configuration behind. I was being told that they will
    configure the email inside the IIS, which i also don't know how to configure.
    I have tried to configure the relay connector inside the exchange before following the same guide by changing the private IP to the web server public ip. i also allowed the permission group to exchange servers and authentication on "externally secured".
    however after i inform the vendor to test it, it didn't work at all.
    i am not able to test using telnet like what i did when doing relay for my internal server. I can't use telnet to test my web server to check whats wrong with the relay. i would like to test like what the guide do, but it is not allowed me to telnet.
    what should i do to troubleshoot? i think that allowing relay of external server is a security breach which is very risky. am i right?
    thanks
    Regards,
    Henry
    Hi Henry,
    Speak to the vendor that manages the web server for IIS setup and ask 'can I use authentication?' If they come back with a 'yes you can' simply provide them with a user/pass so they can authenticate.
    Personally I wouldn't allow a public IP to relay by configuring an Exchange Organisation to allow anonymous relay for a public IP, and would ask that they authenticate.
    If they come back with a no - then we can troubleshoot your Exchange configuration.
    Oliver Moazzezi | Exchange MVP, MCSA:M, MCITP:Exchange 2010,Exchange 2013, BA (Hons) Anim | http://www.exchange2010.com | http://www.cobweb.com | http://twitter.com/OliverMoazzezi

  • HT204053 I created a new apple id because the previous one no longer exists as email (domain had to be cancelled). I keep seeing the old one pop up in my iPhone for which I don't remember the password. How can I get rid of it???

    I created a new apple id because the previous one no longer exists as an email (domain had to be cancelled). I keep seeing the old one pop up in my iPhone for which I don't remember the password. How can I get rid of it??? Or how can I reset the password if the email doesn't exist??? I also tried answering a question (my date of birth) but it says it's wrong.
    I'm really frustrated with the apple id!!!
    Frustrated!!!

    In one of the help pages for managing your Apple ID (http://support.apple.com/kb/HE40), it shows two separate sections, one for Apple ID and one for Primary Email address. When I go to manage my Apple ID, I see only a single section for both. Can the two be 'separated', especially when you face the situation of having to discontinue your email address for some reason?
    I also noticed that when navigating to Apple ID Support Communities, it shows my nickname 'dishdy'. How and when did I insert this? In the current sequence for creating an Apple ID I don't see this. In my current profile I don't see this.
    In any case, I have freed myself from my previous Apple ID (@artemis.it) on my iPhone.
    Thanks for your help.

  • Not receiving email to my MobileMe account from one specific domain

    Starting 2 days ago I stopped receiving email addressed to my "@mac.com" or "me.com" account from one specific domain. Prior to that I had no problem receiving email from that domain. I have no problems receiving email into my MobileMe accounts from many other senders. People with email addresses under this domain can send emails to my Gmail account from the same origination account and they come through just fine. The emails that do not appear are not in my junk mail and they never get "bounced back" to the sender as undeliverable.
    I use Mail under Leopard 10.5.4 with all updates installed.
    It sounds to me like this domain has been "blacklisted" by Apple but I have never heard of them doing this.
    Any suggestions would appreciated.

    petervan 58,
    Just this one person? Your .mac account is getting mail from others OK? Does the person have your email address correct on their phone.

  • How To: Host Two Domains on Lion Server - One IP

    Here is the situation: I own a new MacMini and have installed Lion Server. All of my updates are current. I have purchased two domains from a reputable “Gddy” source. (I don’t know if I can use there official name). I think I am doing something wrong because I have to type the “www.”mydomain.com to get to my websites. How do I host my two sites?
    Here is what I have done so far and have been somewhat successful. For purposes I will refer to my domains in this question as domain1.com and domain2.com. At Gddy my DNS A records for @ both point to my single IP. In addition my www CNAMEs point to @ for both my domains.
    My server admin DNS read the following:
    Name – 1.168.192.in-addr.arpa / Type – Reverse Zone / Value - Blank
    Sub Name – 192.168.1.6 / Type – Reverse Mapping / Value – server.mydomain1.com.
    Name – server.mydomain1.com / Type – Primary Zone / Value – Blank
    Sub Name – server.mydomain1.com. / Type – Machine / Value – 192.168.1.6
    In Lion server I have Web Server turned on and have setup the following web sites:
    server.mydomain1.com
    www.mydomain2.com
    www.mydomain2.com
    I am using iWeb and have both websites loading through SFTP successfully.
    I am using a SSH certificate I created using my apple ID
    Questions:
    Why do my customers need to type the www to access my domains?
    Do I need to setup another primary zone called server1.mydomain2.com?
    Currently everything works fine if you type the www before the domains but I am now on a mission to refine my sites. If users get errors trying to get to my site then they will stop trying and I don't want that. Apple community please help. This stuff really amazes me and the fact that I am somewhat "catching on" is a great feeling. Thank you.

    As Belle points out, this has little or nothing to do with DNS. It's all about Apache.
    When a request comes in, Apache looks at the hostname of the request to determine which site's configuration to use for that request.
    Right now you have two 'sites' configured - 'www.domain1.com' and 'www.domain2.com'.
    When a request comes in for, say, http://domain1.com/ Apache does that same lookup, except it doesn't find a match - you don't have any configuration for 'domain1.com', only 'www.domain1.com'. THESE ARE DIFFERENT.
    There is absolutely no automatic relationship between a host record (e.g. 'www.domain1.com') and its parent domain (e.g. 'domain1.com'). It makes no difference that you have a DNS CNAME that maps one hostname to another because Apache isn't doing DNS lookups on the incoming requests.
    The solution, as indicated, is to tell Apache the list of hostnames that match each site. By telling the 'www.domain1.com' site that it's valid for 'domain1.com' as well (and even 'foo.domain1.com' or 'bar.domain2.com' if you want, too), Apache can serve the request with the appropriate configuration.

  • Change email domain used by Lion Server

    I need some help with getting the names used by my server lined up:
    The server itself is called 'server.<domain>'
    The server lives on an IP address linked to 'www.<domain>'
    The mail system on the server sends / receives mail sent to '<domain>'
    email announcements from the server indicates that the mail is coming from 'noreply@www.<domain>'
    The default email addresses setup using profile manager are all "name@www.<domain>'
    How do I adjust the server settings to get it to default to using <domain> rather than www.<domain> in these circumstances?

    Hello Nivvle,
    This could be due to a substitution being set in System Preferences -> Keyboard -> Text.
    OS X Mavericks: Text pane of Keyboard preferences
    http://support.apple.com/kb/PH14226
    Cheers,
    Allen

  • Change/Add new email domain name to my exchange 2010 server

    My exchange server has a default email domain old.com
    My company decided that they needed to start using new.com domain instead. is there a way to add a new.com to my exchange and manage (add/edit/delete) mailboxes [email protected]?
    Thanks in advance

    Hi,
    Except with the above suggestion, we also need to add public A record about the name Autodiscover.new.com which points to your Exchange server IP address.
    Thanks,
    Angela Shi
    TechNet Community Support

  • EMAIL to external server like Yahoo through SAP

    Hi all,
    I want to send a mail to the vendor when a PO is created through SAP. Please tell me what is the procedure to follow to do it and what all are the setings need to be done in SAP to send Email through SAP to external server like yahoo, rediff etc.
    Thanks

    *&      Form  F_SEND_MAIL
          Send the mail to  corresponding user
    FORM F_SEND_MAIL.
      DATA : LV_TABLE_LINES LIKE SY-TABIX.                   " table index
      CLEAR: V_MSG1, IT_RECLIST.
      REFRESH IT_RECLIST.
    *-popualate email ids
      IT_RECLIST-RECEIVER = V_UNAME.
      IT_RECLIST-REC_TYPE = 'B'.
      IT_RECLIST-SAP_BODY = C_X.
      IT_RECLIST-EXPRESS = C_X.
    *-append receiver table
      APPEND IT_RECLIST.
      CLEAR  IT_RECLIST.
    *-populate document attributes
      CLEAR: X_DOC_CHNG.
      X_DOC_CHNG-OBJ_NAME = 'Error'(M01).
      X_DOC_CHNG-OBJ_DESCR = 'ERROR REPORT'(M02).
    *-populate body text
      IT_OBJTXT = 'Error file is attached'(M03).
      APPEND IT_OBJTXT.
    *-document size
      CLEAR : LV_TABLE_LINES.
      DESCRIBE TABLE IT_OBJTXT LINES LV_TABLE_LINES.
      READ TABLE IT_OBJTXT INDEX LV_TABLE_LINES.
      X_DOC_CHNG-DOC_SIZE =
                   ( LV_TABLE_LINES - 1 ) * 255 + STRLEN( IT_OBJTXT ).
    *-populate packing list for body text
      CLEAR IT_OBJPACK-TRANSF_BIN.
      IT_OBJPACK-HEAD_START = 1.
      IT_OBJPACK-HEAD_NUM = 0.
      IT_OBJPACK-BODY_START = 1.
      IT_OBJPACK-BODY_NUM = LV_TABLE_LINES.
      IT_OBJPACK-DOC_TYPE = C_DOCTYP.
      APPEND IT_OBJPACK.
      CLEAR IT_OBJPACK.
    *-populate object header
      IT_OBJHEAD = 'INET TO SAP Error Report'(M04).
      APPEND IT_OBJHEAD.
      CLEAR  IT_OBJHEAD.
    *--for attachment ---start
    *-populate object bin table for attachment
    *-column header
      LOOP AT IT_MAIL.
        IT_OBJBIN = IT_MAIL.
        APPEND IT_OBJBIN.
        CLEAR  IT_OBJBIN.
      ENDLOOP.
    *-get total no.of lines of Object table(attachment)
      CLEAR : LV_TABLE_LINES.
      DESCRIBE TABLE IT_OBJBIN LINES LV_TABLE_LINES.
    *-populate object header
      IT_OBJHEAD = 'Report'(M05).
      APPEND IT_OBJHEAD.
      CLEAR  IT_OBJHEAD.
    *-packing list for attachment
      IT_OBJPACK-TRANSF_BIN = C_X.
      IT_OBJPACK-HEAD_START = 1.
      IT_OBJPACK-HEAD_NUM = 1.
      IT_OBJPACK-BODY_START = 1.
      IT_OBJPACK-BODY_NUM = LV_TABLE_LINES .
      IT_OBJPACK-DOC_TYPE = C_DOCTYP .
      IT_OBJPACK-OBJ_NAME = 'ABCD'.
      IT_OBJPACK-OBJ_DESCR = 'ERROR REPORT'(M02).
      IT_OBJPACK-DOC_SIZE = LV_TABLE_LINES * 255.
      APPEND IT_OBJPACK.
      CLEAR  IT_OBJPACK.
    *--code for attachment -- end
    *-Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = X_DOC_CHNG
               PUT_IN_OUTBOX              =  C_X
       IMPORTING
            SENT_TO_ALL                =
            NEW_OBJECT_ID              =
           TABLES
                PACKING_LIST               = IT_OBJPACK
               OBJECT_HEADER              = IT_OBJHEAD
               CONTENTS_BIN               = IT_OBJBIN
               CONTENTS_TXT               = IT_OBJTXT
            CONTENTS_HEX               =
            OBJECT_PARA                =
            OBJECT_PARB                =
                RECEIVERS                  = IT_RECLIST
          EXCEPTIONS
               TOO_MANY_RECEIVERS         = 1
               DOCUMENT_NOT_SENT          = 2
               DOCUMENT_TYPE_NOT_EXIST    = 3
               OPERATION_NO_AUTHORIZATION = 4
               PARAMETER_ERROR            = 5
               X_ERROR                    = 6
               ENQUEUE_ERROR              = 7
               OTHERS                     = 8
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 INTO V_MSG1.
        MESSAGE I000 WITH V_MSG1.
      ENDIF.
    Hope this code will be useful

Maybe you are looking for